File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Quick Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Quick Question" Watch "Quick Question" New topic
Author

Quick Question

Ross McManus
Greenhorn

Joined: Jul 28, 2010
Posts: 28
Hi,

Just wondering if someone could answer this for me.

I need to write these three classes going off this UML diagram.




I have wrote them all and the Room & MeetingRoom class's compile fine but on the Bedroom class this line shows up wrong.

Bedroom(int, double, String)
{

}

I am using Netbeans and it says <identifier> expected.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18748
    
  40

Ross McManus wrote:
I have wrote them all and the Room & MeetingRoom class's compile fine but on the Bedroom class this line shows up wrong.

Bedroom(int, double, String)
{

}

I am using Netbeans and it says <identifier> expected.


Can you show us the actual code for the Bedroom class that you did? We can't tell you what if wrong without it.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Ross McManus
Greenhorn

Joined: Jul 28, 2010
Posts: 28
Thanks for the reply. This is what I have for Bedroom.

I also don't think that toString was meant to return roomtype but I did not know what to put so I put that for now.

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18748
    
  40

Methods have a return type. Method parameters have a name (in addition to type).

Constructors parameters have a name (in addition to type).

Henry
Ross McManus
Greenhorn

Joined: Jul 28, 2010
Posts: 28
Thanks but what would the names be as it does not say on the UML diagram yet it does on the MeetingRoom class.
Hunter McMillen
Ranch Hand

Joined: Mar 13, 2009
Posts: 492

Since your diagram doesn't give you a name, I'm assuming it's left up to you to choose a name for them. Either that or there is an error in the UML diagram.

If you look at the Room superclass is has three variables of type int,double,string.


Hunter


"If the facts don't fit the theory, get new facts" --Albert Einstein
Ross McManus
Greenhorn

Joined: Jul 28, 2010
Posts: 28
Hunter McMillen wrote:Since your diagram doesn't give you a name, I'm assuming it's left up to you to choose a name for them. Either that or there is an error in the UML diagram.

If you look at the Room superclass is has three variables of type int,double,string.


Hunter


Thanks for that, it has fixed it.

Im sure I tried using them names before but it did not work but for some reason it has worked now.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38426
    
  23
Welcome to the Ranch

It is a lot easier to answer questions if you know in advance what they are about.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Quick Question