Submit the following program: Write a Java program GuestsList . application which uses the ArrayList to create the registry of hotel guests. On each day, some guests could be added to the registry,...

Submit the following program:

Write a Java programGuestsList. application which uses the ArrayList to create the registry of hotel guests. On each day, some guests could be added to the registry, removed from the registry, their data could be edited (e.g., correcting a misspelled name). An ArrayList would meet these tasks nicely. Before proceeding to coding, review the code samples for Week 4 in the Doc Sharing area and see how to create an ArrayList of specific object type, add objects to ArrayLists, remove objects, and reset the existing objects with the new data.

First:

Create a simple classGuestwhich has two attributes: guest’s FirstName and guest’s LastName. Add get and set methods for each field. Add overloaded constructor which accepts First Name and Last Name as parameters and assign those to the class FirstName and LastName fields when creating a Guest object. Save asGuest.java.Compile and be sure there are no errors in the code.

Second:

Code theGuestListdriver class, which will have two methods.

Create thedisplayGuests()method which takes ArrayList of Guests objects as a parameter and displays all guests registered in that ArrayList :

static void displayGuests(ArrayList aList) {
for(int index = 0; index
{
Guest currentGuest = aList.get(index);
System.out.println ("Registered Guest : " + currentGuest.getFirstName() + " " + currentGuest.getLastName());
}
}

In the mainmethod:

Declare and create the ArrayList object where you will store guest’s data:

ArrayList nameList = new ArrayList();

Create several Guest objects with guest names:

Guest guest1 = new Guest (“John”, “Doe”);
Guest guest2 = new Guest (“Mary”,”Smith”);

Continue until you have five Guest objects created.

Add the Guest objects to the nameList:

nameList.add (guest1);
nameList.add (guest2);

… and so on for all five guests.

Call the displayGuests(nameList) method using the nameList formed above as a parameter in order to display registered guests stored in the nameList.

Then, update the nameList :

--- add two more new guests

--- delete the guest who has registered first.

--- change the first name of the Mary Smith guest to Jane Smith.

Call the DisplayGuests method again to see that the changes worked out correctly.

Save the GuestList class asGuestList.java.

Make your application user friendly and explain to potential users what they see (i.e., a list of initially registered guests, the modified list with changes made, etc.). Format the output in an orderly fashion for easy reading.

Add the proper Header to GuestLis.java file. Do not forget to include the comments for the code statements in the .java files to explain what those statements do.

Create a UML class diagram of the application illustrating class hierarchy, collaboration, and the content of each class (include as a part of the MS .doc documentation below).

May 10, 2021

Submit New Assignment

Copy and Paste Your Assignment Here