This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Quick Question

 
Ross McManus
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ross McManus
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 492
Firefox Browser Linux VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ross McManus
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 47281
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

It is a lot easier to answer questions if you know in advance what they are about.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic