First of all I'm new to this site but it certainly looks like a place that i will be visiting more often!
Onto my problem.
I am creating a Hotel Bussiness project in java using BlueJ
The classes are as follows:
Hotel - Deals with the major functions of the hotel (i.e guests booking in, finding rooms etc.)
Room - Used to decide whether a room has a sea view and stores the guest that is in the room.
Occupier - For information about the group occupying a room with methods for amount of nights stayed and nights eaten dinner.
I have completed the Room and Occupier classes with no trouble at all.
My downfall is creating the hotel class.
The class has 3 fields so far they are
The constructor is as follows:
And here is the problem, the setRoom is a private method used to declare each entry in the array as a new room object. Even numbers having a sea view. The part labelled as SOMETHING is where i wish to step into the array and set each room object as sea view or no seaview. The problem is i just don't know how to put this into code. Here is my attempt althogh after much brain ache i am starting to think using a while or for loop would work?
Also note that the hasSeaView method has already been set in the Room class.
I have reffered to all of my work books and scoured the interweb but just can't find a decent example to see what to put here.
Thanks in advance.
Onto my problem.
I am creating a Hotel Bussiness project in java using BlueJ
The classes are as follows:
Hotel - Deals with the major functions of the hotel (i.e guests booking in, finding rooms etc.)
Room - Used to decide whether a room has a sea view and stores the guest that is in the room.
Occupier - For information about the group occupying a room with methods for amount of nights stayed and nights eaten dinner.
I have completed the Room and Occupier classes with no trouble at all.
My downfall is creating the hotel class.
The class has 3 fields so far they are
Code:
private Room[] Rooms; private int Profit; private int FreeRooms;
Code:
public Hotel(int totalRooms) { Profit = 0; FreeRooms = totalRooms; setRoom(); }
Code:
private void setRoom() { Rooms = new Room[FreeRooms]; if (Rooms.SOMETHING % 2 = 0){ Room.hasSeaView = true; } else Room.hasSeaView = false; }
I have reffered to all of my work books and scoured the interweb but just can't find a decent example to see what to put here.
Thanks in advance.
Comment