Java Programming I don't get (Homework help basically)

Started by Azasuke Kaijin, February 18, 2010, 09:24:06 PM

Previous topic - Next topic

Azasuke Kaijin

Ha ha I have no idea what's going on. If any of you know and are willing to help (Even answer!) it would be so amazing. Maybe even explain what's going on.

This is about classes. And mutators and a whole bunch of stuff that I don't even get.

1. Assume that a class named Auto exists. The Auto class has three messages that can be sent to it to obtain the make, mode, and year of an Auto object. The message names are getMake(), getModel(), and getYear(). None of these messages have any input parameters. The getMake and getModel messages return a string value, and the getYear message returns an integer value. Write the code statements required to declare a variable of type Auto, and send the three messages listed above to obtain the default values generated when the object was instantiated. Use the System.out method to print the values obtained to the screen.

2. Write the code for three constructors for the Auto class mentioned in a previous question. The Auto class has three instance variables named make, model, and year. The make and model are String objects, and the year is an integer value. Write a default constructor that initializes the make and model fields to a null value and the year variable to a value of 0. Write an initializing constructor that accepts parameters from the caller to set the values. Finally, write a copy constructor that accepts an Auto object as a parameter and copies its values to a new instance of the object.

If it helps any, we're as far as Chapter 5 in the Fundamentals of Java AP* Computer Science Essentials for the A and AB exams.
The Answer to the Ultimate Question:

For rare M.U.G.E.N. characters, click here.

Iced

So...do you want it straight up answered or to be taught what it is about?

And say functions instead of messages.

Anjel

Well, if you don't get it, read about it and Google for code snippets you can look at. We won't do your homework for you.
My shitty mugen stuff:

Valodim

what the hell "messages"? is this supposed to make it easier to understand or something, picturing the objects as postmen for their class delivery services? o_O

anyways, really basic stuff. here's the first of the second question, hope you can work from there:
Code (java) Select

Auto() {
  this.make = null;
  this.model = null;
  this.year = 0;
}

MirageAtoli

Don't you have any labs or examples you can go off of?
Quote from: Titiln on December 31, 2007, 10:46:10 PM
i think we should call it an "engine" so we don't look like total idiots because otherwise we'd be arguing about a "game" and that would be somehow "dumber" than arguing about an "engine" on the "internet" for countless hours

Quote from: Beatrice on March 01, 2010, 06:55:03 PM
Quote from: Iced
I for one, do not enjoy round corners!  :bigcry:
But they hurt much less when we accidentally hit them!  :S