The goal of this assignment is to practice linked lists


Assignment

Objective: The goal of this assignment is to practice linked lists.

Background: Suppose that you like traveling and you are planning on visiting your friends who live in different towns of Texas during Spring Break. Use a linked list to plan and organize the sequence of your visits to your friends.

Task: Write a class named Friend. The Friend class must contain the following three private data fields.

the name of the friend,
city name where your friend lives,
price/budget of the gift you are planning to purchase for this friend.

Note that you will need an additional reference field to link to the next Friend of the list. This reference field can be public. Write appropriate setter and getter methods to set and access all the private fields.

Write a different class named Organizer to maintain a linked list containing Friend elements.

Write methods within the Organizer class:

for starting a linked list with the first person,
for inserting a new friend to the list,
for deleting a friend from the list,
for searching whether a given friend is on your list,
for printing the entire list of friends you are planning to visit, and
for computing the total amount of money you are planning to spend to buy gift items for your friends.

In the main method of the Organizer class, test your methods by filling in information about at least five different friends to visit, and by printing the resulting list. Also, display the total amount of money you are planning to spend on gifts. To test insertion and deletion, add one of your friends who is not already in the list, and show that you can search for this friend. Delete a friend from the list to demonstrate that your delete method works perfectly.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: The goal of this assignment is to practice linked lists
Reference No:- TGS02706641

Expected delivery within 24 Hours