Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Need some help

I have an exam next week and to be honest i don't know nothing about java but I need to pass this module in order to graduate. I been going to all the lectures but I still can't understand it, anyways I was wondering if anyone can help me. I have some practice questions for the exam and i was wondering if someone can answer them for me and explain them so i can get an idea of what to do. Thank You

TASK A
Open the Eclipse IDE. In your user area create a New Project with an appropriate name to be used
throughout this examination. Inside your project create a New Class entitled Room. Modify the
skeleton code produced by Eclipse so that it matches the class diagram below (you will need to
include the attributes which should default to appropriate values).

Room
-length: int
-width: int

TASK B

Modify your Room class to include the constructor and methods shown in the revised class diagram
below. The constructor accepts two arguments and should set width and length to these values. The
getLength() and getWidth() methods should return the appropriate attributes. The getArea() method
should return the area of the room (calculated as its length multiplied by its width).

Room
-length: int
-width: int
+Room( aLength: int, aWidth: int)
+getLength(): int
+getWidth(): int
+getArea(): int

Create a demonstration class for Room that constructs an instance of the Room class as shown in
the instance diagram below.

bedroom: Room
length: 10
width: 12

Display the results of using the getLength(), getWidth() and getArea() methods on your new
instance.

Once again thank you
[1741 byte] By [Johny2005] at [2007-11-11 8:09:25]
# 1 Re: Need some help
Have you opened Eclipse as requested?

What is the class skeleton code before any modifications?

Post what modifications you've written so far so people can HELP you by supplementing or guiding the work that YOU are doing.

What does a class declaration (signature) look like? What should the Room signature look like?

How do you declare data members of a class?

How do you declare and define methods in a class?
What does a constructor look like? What does it do?
What does a "getter" method look like? What does it do?

What method do you add to a class to "demonstrate" the class?
What is that method's signature?
What should that method contain?
nspils at 2007-11-11 22:36:19 >
# 2 Re: Need some help
no code was given and I don't know anything about java so i was hoping to get some help on how to do it, thanks
Johny2005 at 2007-11-11 22:37:24 >
# 3 Re: Need some help
no code was given and I don't know anything about java so i was hoping to get some help on how to do it, thanks
You should start with the Java tutorial ( http://java.sun.com/docs/books/tutorial/), in that case. Writing everything in this post would be a bit too much.
aniseed at 2007-11-11 22:38:22 >