Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSE 143 travel destination assignment: Imagine that you're going to keep track of some data. In this case, you're going to keep track of a

CSE 143 travel destination assignment:

Imagine that you're going to keep track of some data. In this case, you're going to keep track of a collection of travel destinations. Each attraction has a name (a string), a location (more strings for city and country), and a distance (a double).

Distances between locations can be determined here: http://www.distance.to/

For this assignment, you're going to create a program that will manage a linked list of travel attractions. There's a twist, however each node in the linked list will actually have TWO next pointers, so that you can have two 'lists' stored in the same place. There's going to be 1 list for the attractions, sorted according to name, and there's going to be a second list, sorted according to location (city/country). A picture of how this might look is given below:

image text in transcribed

Notice how each Attraction has a 'next by name' AND a 'next by location' reference.

Thus, if we were to print the attractions by following the links in the attraction list, we'd get:

Attraction Name: Eiffel Tower

Attraction City: Paris

Attraction Country: France

Distance from Seattle: 4996.44

Attraction Name: Empire State Building

Attraction City: New York

Attraction Country: USA

Distance from Seattle: 2401.76

Attraction Name: Golden Gate Bridge

Attraction City: San Francisco

Attraction Country: USA

Distance from Seattle: 679.26

Likewise, if we were to print the attractions by following the links in the city list, we'd get:

Attraction Name: Empire State Building

Attraction City: New York

Attraction Country: USA

Distance from Seattle: 2401.76

Attraction Name: Eiffel Tower

Attraction City: Paris

Attraction Country: France

Distance from Seattle: 4996.44

Attraction Name: Golden Gate Bridge

Attraction City: San Francisco

Attraction Country: USA

Distance from Seattle: 679.26

You need to implement a program that will allow someone to add a destination, remove a destination, and print the destinations (Attractions) by either name or location. In addition, provide load and save feature for loading and saving Attractions to / from a file (destinationlist.txt). The Attraction objects must be stored in the 'multi-linked lists' described above. If you have two attractions with the same name, then they should be put into sorted based on their different locations (and likewise with attractions in the same location, sort by name). Do NOT allow duplicate Attractions (same name and same location) to be added.

To be clear: you need to implement not just the data structures that store this information, but you also need to finish implementing the Console-based user interface that will allow the user to interactively create destinations, print the list, and remove destinations.

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

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions