Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions