Check that out first, then give it a shot--if you still have further questions, post the if statement syntax you're trying and we'll take it from there!
Ross McManus wrote:
if roomNumber = 201 to 203
{
rate = 35
}
I don't know whether I understood you question properly. But my suggestion:
Is this you want?
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Ross McManus
Greenhorn
Joined: Jul 28, 2010
Posts: 28
posted
0
Abimaran Kugathasan wrote:
Ross McManus wrote:
if roomNumber = 201 to 203
{
rate = 35
}
I don't know whether I understood you question properly. But my suggestion:
Is this you want?
Yes that is exactly what I needed thanks for the reply.
Also David Newton thanks for the link as well.
Ross McManus
Greenhorn
Joined: Jul 28, 2010
Posts: 28
posted
0
I have another question if someone could help.
On the sheet I have it says.
"If a room is not booked, the customer is null"
I guess I have to write an if statement somewhere to check if the room has been booked or not and then set the customer to null?
Does anyone know where I would write this code?
I have a bookRoom(String); Method would it be in there?
Here is the room code again. In the if statements that I wrote before I have added customer = null; Because on the sheet it said "All rooms may have a customer, Initially the customer will be null."
I have a bookRoom(String); Method would it be in there?
No, that would be backwards. When a customer checks out the room would no longer have a customer.
I don't understand the purpose of "n".
Here's something else to consider.
Is a customer an intrinsic property of a room? Or is a customer something that occasionally occupies a room? What if a room has more than one person in it? What if the same person pays for multiple rooms? My initial reaction is that I'd have a map of rooms to customers in the room, rather than a room having a customer. (Or a customer having a room.)
In addition, is room booking something that a Room class should know anything about? Or is room booking something that whatever *contains* the rooms should know something about? And why should a room understand pricing rules? What if they change? Why should a room know number ranges of *other* rooms? In other words, if I'm room 235, should I really know about room 240?
Please do not hand out answers on a plate; our goal at JavaRanch is to be something other than a code mill--please see NotACodeMill.
Since it's too late, I have not removed your solution.
Really sorry. apologize me! Won't happen anymore!
Ross McManus
Greenhorn
Joined: Jul 28, 2010
Posts: 28
posted
0
David Newton wrote:
I have a bookRoom(String); Method would it be in there?
No, that would be backwards. When a customer checks out the room would no longer have a customer.
I don't understand the purpose of "n".
Here's something else to consider.
Is a customer an intrinsic property of a room? Or is a customer something that occasionally occupies a room? What if a room has more than one person in it? What if the same person pays for multiple rooms? My initial reaction is that I'd have a map of rooms to customers in the room, rather than a room having a customer. (Or a customer having a room.)
In addition, is room booking something that a Room class should know anything about? Or is room booking something that whatever *contains* the rooms should know something about? And why should a room understand pricing rules? What if they change? Why should a room know number ranges of *other* rooms? In other words, if I'm room 235, should I really know about room 240?
I am not sure, On the sheet I got it has a UML diagram and I just created the class's off what was specified in the UML diagram.
Oh, well, if you're coding to a spec it doesn't matter then. If you changed your code and want feedback on it, post a new message rather than editing the original.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.