There are a sotall of five classes and one enum required for this project. Over
ID: 3906507 • Letter: T
Question
There are a sotall of five classes and one enum required for this project. Over the course of the projeet, it is important that you pay attention to how different responsibilities are separaled between the classes and how they work in coejuncticn to handle a probiem A quick list of the necessary items for this peogram are HotelManagement Class This is the driver class foe your peogram It will cntain a methed for setting up an initial hotel and the main method which will stant the rest of your peogram. HotelMen-Class-This class controls user input ans the main your program. All input and output should be handled theough this class. ? nt of interaction with Hotel Class-Contains the rooms that guests can reserve. Manages the actial creation and Room Class-Represents the places within the hotel in which a guest can reserve and maintains information about the current occupants. Guest Class-Represents the individual who makes a reservation and the person who the reservation is under BedType Enum-Each room has exacily one bed which is either a double, queen or king sized bed. This enum provides comvenient means for dealing with the different types We will go through the requirements for each class in the following sections This class serves two diflerent purposes. First is the initial entry point for your program. It is often best to separate the entry point of a program from other parts of the code. This makes it easier to identify the starting point and also allows other classes to focus on their own responsibilities You need two methods for this class static Hetel createlnitialHotel -this method is in charge of jus creating an initial hote for the program to use. You will need to create a new Hotel object and add an initial set of rooms to that hotel. It is fine to use a small number ofhoecl room four to five should be The main methed-the only responsibilities of the main method are to get the initial hotel from the previous method, create a new Hotel Menu foe that hotel, and then to call the startMenu method HotelMenu Class The HotelMenu class contains all code related to input and output. It is common to separale classes that deal with input and output from other classes that deal peimanly with logic or maintaining data This makes it easier to identify sach code and to make changes to that code when necessary You must have the following instance variables: Scanner ebjeet that will be used for reading input from the user A Hotel object to maintain rooms and reservations A You must have the following public methods: . void startMenu0-This is the method that presents the initial menu when the program first starts up (see User Menus). I is called by the main method when running the program This method will take in a user's seloction for the menu and then cal the private handleSelection method to deal with the user's selection. It will do this in an infimie loop until the peogram is fisally exited Hotelenu(Hotel hotel)- a parameterized constractor for setting up a new menu for a given HotelExplanation / Answer
HotelManagement.java
public class HotelManagement{
static Hotel createInitialHotel(){
Hotel obj = new Hotel();
obj.addRoom();
}
public static void main(){
Scanner sc=new Scanner(System.in);
System.out.println("Welcome to Holiday Inn Express");
System.out.println("Please make a selection from the following options:");
System.out.println("1. Make Reservation");
System.out.println("2. Cancel Reservation");
System.out.println("3. List Reservations");
System.out.println("4. List All Rooms");
System.out.println("5. Exit Program");
System.out.println("Selection:");
int selection = sc.nextInt();
switch(selection){
case 1: System.out.println("Enter the Guest Name");
String name =sc.nextInt();
System.out.println("Enter the size of the party");
int partySize = sc.nextInt();
System.out.println("Enter the Bed Type");
String BedType = sc.nextInt();
break;
case 2:
System.out.println("Enter the Guest Name");
String name =sc.nextInt();
if(){
}
break;
case 3:
case 4:
case 5: System.Exit();
default:
System.out.println("Wrong Selection");
}
}
}
Room.java
public class Room{
int roomNumber;
Guest currentOccupants;
BedType bedType;
public Room(int roomNumber, BedType bedType){
this.roomNumber=roomNumber;
this.currentOccupants=null;
this.bedType=bedType;
}
public boolean reserveRoom(Guest newGuest){
if(newGuest instanceof Guest){
return true;
}
return false;
}
void freeRoom(){
this.Guest=null;
}
boolean isAvailable(){
if(freeRoom())
return true;
else
return false;
}
String toString(){
}
getGuestType(){
currentOccupants.getName();
}
getPartySize(){
currentOccupants.getPartySize();
}
getRoomNumber(){
return roomNumber;
}
getBedType(){
return BedType;
}
setBedType(BedType bedType){
this.bedType=bedType;
}
}
Guest.java
import java.util.Arrays;
public class Guest{
String name;
int partySize;
Object[] items;
final int size;
public void Guest(String name, int partySize){
this.name=name;
this.partySize=partySize;
}
public Guest(Object... values){
this.size=values.length;
this.items=Arrays.copyOf(values,size);
}
public void getName(){
return name;
}
public void setName(String name){
this.name=name;
}
public void getPartySize(){
return partySize;
}
public void setPartySize(int partySize){
this.partySize=partySize;
}
@Override
public String toString(){
return Arrays.toString(items);
}
}
BedType.java
enum BedType(DOUBLE, QUEEN, KING){
DOUBLE=1;
QUEEN=2;
KING=3;
}
Hotel.java
public class Hotel{
int[] rooms;
int currentNoOfRooms;
int currentNumberOfReservations;
String hotelName;
public void Hotel(){
}
public void Hotel(String name, int maxNumberOfRooms){
}
void getName(){
}
void setName(){
}
void addRoom(Room newRoom){
}
boolean makeReservation(Guest newGuest, BedType desiredBedType){
}
boolean cancelReservation(String guestName){
}
void Room[] getRooms(){
}
void Room[] getReservations(){
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.