The Artima Developer Community
Sponsored Link

Java Answers Forum
Classes

2 replies on 1 page. Most recent reply: May 18, 2002 11:08 AM by Evgen

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
trent

Posts: 1
Nickname: tomo
Registered: May, 2002

Classes Posted: May 17, 2002 2:48 PM
Reply to this message Reply
Advertisement
I am making a small hotel program. I have two classes so far which are Room.java and Hotel.java. I have just begun to create the HouseManager class which calls methods from the previous two classes but i am having trouble getting it to work. In this case the user enters the number of guests needing accommodation, the value is passed to gethotelAvailableRooms method of the hotel object, the returned string is captured and displayed.
The method gethotelAvailableRooms is:
public
String gethotelAvailableRooms (int noGuests)
{
String availRooms="";
for(i = 0; i < aPub.length; i++)
{
if(aPub.isBooked = false && aPub.getnumberBeds() >= noGuests)
availRooms=availRooms + i + ",";
}
return availRooms;
}

and what i have so far is this:
{
int noGuests;
System.out.println( "How many guests are there?");
noGuests = kb.getInt();
System.out.println( "The following rooms are available:");

}


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Classes Posted: May 18, 2002 10:56 AM
Reply to this message Reply
I think you need to provide more context and more precisely state the exact trouble you are having before anyone can help...

Evgen

Posts: 14
Nickname: evgen79
Registered: May, 2002

Re: Classes Posted: May 18, 2002 11:08 AM
Reply to this message Reply
Try replace:
if(aPub.isBooked = false &&

to
if(aPub.isBooked == false &&

Flat View: This topic has 2 replies on 1 page
Topic: Can anyone help please. Previous Topic   Next Topic Topic: Vertical title

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use