Question: on java Hotel Guest - id: int - name: String - nationality: String - age: int - guests - name : String - guestCount :

on java
Hotel Guest - id: int - name: String - nationality: String - age: int - guests - name : String - guestCount : int + Hotel(String, int) + reserve(Guest) : boolean + checkout(Guest) : boolean + countGuests(String) : int + getOldestGuest(): Guest + getGuests(String) : Guest[] + splitGuests(Guest[], Guest[]): int + print(): void 1 + Guest(int, String, String, int) + getNationality(): String + getAge(): int + setName(String) : void + equals(Guest) : boolean + toString(): String Guest Class: o Methods: Guest(id:int, name:String, nationality:string, age:int): constructor equals(g:Guest): compares this with g and returns true if they are equal or false otherwise toString(): returns a string representation of a Guest object Hotel Class: o Methods: Hotel(name:String, size:int): constructor reserve(g:Guest): adds a guest to the hotel if possible and returns true if succeeds or false otherwise checkout(g:Guest): removes a guest from the hotel if possible and returns true if succeeds or false otherwise countGuests(n:String): counts and returns the number of guests of the hotel who are of a certain nationality getOldestGuest(): finds and returns the oldest guest of age in the hotel if possible getGuests(n:String): returns an array containing all guests of the hotel who are of a certain nationality splitGuests(saudi:Guest[], expat:Guest): inserts all Saudi guests into one array and all non-Saudi guests into the another and returns the number of non-Saudi guests print(): prints the info of all guests in the Hotel Exercise 1: Write the classes Guest and Hotel. Exercise 2: Write an interactive java program that offers the user the following menu: Enter the name of the Hotel and the number of rooms in it: To add a new guest, Enter 1 Enter the info of the guest: To get the number of guests of a given nationality, Enter 2 To print the info of the oldest guest, Enter 3 To print the info of all guests of a given nationality, Enter 4 Enter the nationality: To print the info of all Saudi guests in the Hotel, Enter 5 To print the info of all guests in the Hotel, Enter 6 To Exit, Enter - 1 Are you sure you want to exit? (Y/N): Enter Your Option: Note: for option number 5, use method split to get the info of all Saudi guests (the arrays for Saudi and non-Saudi guests should be created with the exact number of corresponding guests) your program should only halt when the user chooses to (i.e. enters -1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
