Question
For this project, create an instance/object called tourist of a linked list class. The linked list class must have a nested node class that holds
For this project, create an instance/object called tourist of a linked list class. The linked list class must have a nested node class that holds the following information about tourists. I have provided sample data for one tourist.
Name: Waldo Passport Number: 12345 Destination: Prague
You can use the Node code from the modules, but you will need to modify it to hold the above instance variables for each node. The linked list class must have the following methods (you can change the parameter names if you wish): public void addFirst(String touristName, int passportNumber, String destinationCity) //adds a new tourist to the beginning of the list public int size() //returns the number of tourists in the list public String findNode(String touristName) /* finds the tourist's name in the list and returns the destination. Use iteration or recursion to traverse the list */
Testing
In the main method, create an object of your linked list class and call its methods for testing.
Use the addFirst method to add at least three tourists.
Use the findNode method to find three tourists by name.
Search for each tourist to test the findNode method for a tourist at the beginning of the list, in the middle of the list and at the end of the list.
Also, run findNode to attempt to find a tourist that does not exist in the list.
The program should run without errors or unhandled exceptions.
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