Question: CSC113 - Computer Programming II - Aggregation Lab - Spring 2020 Hotel Guest - id: int - name: String - nationality: String - guests age:

CSC113 - Computer Programming II - Aggregation Lab - Spring 2020 Hotel Guest - id: int - name: String - nationality: String - guests age: int - name : String -guestCount: int + Hotel(String, int) + reserve (Guest) : boolean + checkout(Guest): boolean + countGuests(String): int + getOldestGuest(): Guest + getGuests(String): Guest() + splitGuests(Guest(), Guest(l): 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: . Guestid: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: Methods Hotelname:String, size:int) constructor reservelg:Guest): adds a guest to the hotel if possible and returns true if succeeds or false otherwise . checkoutle:Guest): removes a guest from the hotel it possible and returns true if succeeds or false otherwise - countGuests:String) counts and returns the number of guests of the hotel who are of a certain nationality gerOldes Guesto): finds and returns the oldest guest of age in the hotel if possible gerGuess: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 printo: 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 fie enters - 1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
