plz help me

plz help me

Post by sese » Sun, 23 Oct 2005 00:16:33


want to ask about the container class

The Hotel class must also contain some methods which initialise the
collection of rooms. Specifically your Hotel class should have the
following methods:

A default constructor. This must instantiate the Room array. We will
assume that there are 20 rooms in the hotel and so the array needs to have
length 20. The constructor then needs to do several other initialisation
tasks for the rooms. Each of these tasks can be defined in its own
separate method. The constructor can then call these methods. The tasks
are described in the following bulleted points...
A method which traverses the array and instantiates a default Room
object referenced by each array cell. From this point onwards, we will
assume that each room in the hotel has a number which is the same as its
index in the array - room number 6 will be in cell 6 of the array, etc.
A method which traverses the array and sets the tariff of all the even
numbered rooms to $58 (these all have views of the city); and sets the
tariff of all the other rooms to $78.50 (these have water views). This
method should also set the tariff of room 0 (the first cell in the array)
to $1480 (it the penthouse suite!).
A method which sets the number of beds to 4, in the last 5 rooms. This
method should also set the number of beds to 1 for rooms 1 though 5
inclusive.

The Hotel class will contain several methods which do tasks associated
with hotel management.

A method which accepts an integer argument representing a room number
and returns a reference to the Room object in that cell of the array. If
the argument is illegal, a null reference should be returned. Call this
method etRoom
A method which returns the number of rooms which are booked.
A method which returns the number of rooms which are not booked.
A method which returns the total value of all the tariffs of all the
booked rooms. This simulates one day income for the hotel.
A method called etAvailableRoomswhich accepts an integer
representing a number of guests which need a room. This method should
return a String in which there is a list of all the unbooked rooms which
have enough beds for the prospective guests.
A method which accepts a String holding the first few characters of a
guest name and searches through all the rooms looking for the first
guest whose name starts with those characters. The method should return
the number of the room when a match is found. If the name cannot be found,
the method should return -1. Call this method indGuestRoomNumber


[quote]public class Hotel
{
private final int SIZE = 20;
private Room[] rooms;
private int numberOfRooms;

public Hotel()
{
rooms = new Room[SIZE];
numberOfRooms = 0;
}

public Hotel(int size) <{
if (size <= 0) // invalid size
rooms = new Room[SIZE];
else
rooms = new Room[size];
numberOfRooms = 0;
}


public void nom(Room roomNum)
{
rooms[numberOfRooms] = roomNum;
}

public void cost()
{
fo<(int i = 2;i<=rooms.length;i+=2)
{
rooms.setTariff(58.0);
}

fo<(int i = 1;i<=rooms.length;i+=2)
{
rooms.setTariff(78.50);
}

fo<(int i = 0;i<=rooms.length;i+=0)
{
rooms.setTariff(1480.0);
}
}

public void numberBed()
{
for<int i = 15;i<=rooms.length;i++)
{
rooms.setNumOfBeds(4);
}

fo<(int i = 1;i<=5;i++)
{
rooms.setNumOfBeds(1);
}
}

public String getRoom()
{
String msg = "All rooms\n";
fo<(int i = 0;i<=numberOfRooms;i++)
{
msg=r
 
 
 

plz help me

Post by Andrew Tho » Sun, 23 Oct 2005 00:35:48


(big snip)


Aha! A question! I had to copy the entire text into a text
editor and search on '?' before I found it buried between the
code samples.


OK.. Goodo..

The answer to your question is

"A number of people who read this usenet news group are
capable of helping you, but they would need more information
to do that, as well as more direct questions from you."

Your questions should come one at a time, and be very
specific to an immediate problem.

You are not likely to get 'hold my hand and show me exactly'
type help, here.

 
 
 

plz help me

Post by HalcyonWil » Sun, 23 Oct 2005 04:47:11


Yes, good to see you working hard to post so much, but can you clarify
your question. What do you want to write. What problem are you facing.
 
 
 

plz help me

Post by Roedy Gree » Sun, 23 Oct 2005 06:03:00

On Fri, 21 Oct 2005 11:16:33 -0400, "sese" < XXXX@XXXXX.COM >
wrote or quoted :


How come then did not say so in your subject line?

How come you then asked no questions about Containers, but instead
posted your homework assignment. See
http://www.yqcomputer.com/

--
Canadian Mind Products, Roedy Green.
http://www.yqcomputer.com/ Again taking new Java programming contracts.