Hi guys, I'm a student teacher at a high school in Washington D.C. and I've come across a slight problem. See, I'm a math major, but one of the computer science teachers just quit and they need me to fill the position. I have to write this program out by tomorrow and I've tried to learn basic java, but I have no idea how to do this assignment. Basically, I need an answer key for this class and the teacher before didn't leave one. I'm expected to hold the fort down for the next month and I have no idea how to do java. I'd be happy to send someone a check if they could do this program and send me the .java file within the next five hours.
This is the next assignment the teacher would have done and I am expected to continue his curriculum.
Project Specifications
1. Your program must be in a file named Proj2.java and your room class should be in a file called GuestRoom.java.
2. In GuestRoom.java you must declare instance variables for the roomNumber, bedType, number of beds, maximumOccupancy, nightlyRate, number (an int set to zero to start referring to the number of people in the room), numberOfNights (an int set to 0 to start), and occupant (a string set to the empty string to start).
3. You must implement a constructor method which takes five parameters that will be used to initialize the uninitialized instance variables (roomNumber, bedType, numberOfBeds, maximumOccupancy, and nightlyRate). You will also need to build accessor and mutator methods for all eight instance variable, and a toString method that returns a nicely formatted, multi-line description of the room. In toString(), you will need to create a NumberFormat object to print the nightly rate, so don't forget to import the NumberFormat class.
4. Processing Specifications:
* Your main program should start by creating and initializing 3 room objects. Use the following data for the 3 rooms:
o 103,"double", 2, 4, 89.99
o 205, "queen", 2, 4, 109.99
o 312, "king", 1, 2, 159.99
* Print out the information about each room. (toString)
* Change the occupant of the 1st room to "Mr. Fred Flintstone".
* Change the number of people in the 1st room to 1.
* Change the bedType in the 1st room to "queen".
* Change the occupant of the 3rd room to "Mr. Hugh Heffner"
* Change the number of people in the 3rd room to 2.
* Change the nightlyRate for the 3rd room to 199.99.
* Change the nightlyRate for the 1st room 129.99
* Change the nightlyRate for the 2nd room to 119.99
* Change the numberOfBeds to 1 for the 2nd room.
* Change the maximumOccupancy to 2 for the 2nd room.
* Change the numberOfNights to 3 for the 3rd room.
* Print out the new information for all three rooms. (toString)
* Print out the roomNumber, occupant and total charges (nightlyRate * numberOfNights (you may need a NumberFormat object here)) for room 3. (accessor methods)
* Print out the roomNumber and occupant for room 1 (accessor methods).
* End the program
Output Specifications
There is no keyboard interaction with this driver program so all you will get is output which should look like:
Room no: 103
Bed Type: double
Number of Beds: 2
Max occupancy: 4
Nightly Rate: $89.99
Occupant:
Number of People: 0
Number of Nights: 0
Room no: 205
Bed Type: queen
Number of Beds: 2
Max occupancy: 4
Nightly Rate: $109.99
Occupant:
Number of People: 0
Number of Nights: 0
Room no: 312
Bed Type: king
Number of Beds: 1
Max occupancy: 2
Nightly Rate: $159.99
Occupant:
Number of People: 0
Number of Nights: 0
Room no: 103
Bed Type: queen
Number of Beds: 2
Max occupancy: 4
Nightly Rate: $129.99
Occupant: Mr. Fred Flintstone
Number of People: 1
Number of Nights: 0
Room no: 205
Bed Type: queen
Number of Beds: 1
Max occupancy: 2
Nightly Rate: $119.99
Occupant:
Number of People: 0
Number of Nights: 0
Room no: 312
Bed Type: king
Number of Beds: 1
Max occupancy: 2
Nightly Rate: $199.99
Occupant: Mr. Hugh Heffner
Number of People: 2
Number of Nights: 3
312 Mr. Hugh Heffner $599.97
103 Mr. Fred Flintstone