Question
Can someone do this assignment for me ASAP please thank you so much in advance. You have already discovered in this weeks Discussion that both
Can someone do this assignment for me ASAP please thank you so much in advance.
You have already discovered in this weeks Discussion that both arrays and ArrayLists are essential tools when storing and manipulating data. In this application, you will be asked to perform the tasks specific to ArrayLists, such as adding new items to an ArrayList, removing and resetting ArrayList items, as well as displaying an ArrayList content.
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, 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 class Guest which has two attributes: guests FirstName and guests 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 as Guest.java. Compile and be sure there are no errors in the code.
Second:
Code the GuestList driver class, which will have two methods.
Create the displayGuests() method which takes ArrayList of Guests objects as a parameter and displays all guests registered in that ArrayList :
static void displayGuests(ArrayList
In the main method:
Declare and create the ArrayList object where you will store guests data:
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 as GuestList.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).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started