Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the program in C + + , utilizing templates and STL: The trajectory of a Road Trip can be organized as a series of

Complete the program in C++, utilizing templates and STL:
The trajectory of a Road Trip can be organized as a series of cities and distances from previous city stored in an STL list Trip.
In order to program this application you need to follow the following recipe:
a. Create a Node class that contains the name of city and distance from previous city (string location, int distance)
b. The Node class contains the following:
Default and Parametrized constructors
Copy constructor
Destructor
Overloaded assignment operator=()
Overloaded output operator<<() friend function
c. Create an empty list of Trip Nodes Trip
d. Create a trajectory of 10 Trip Nodes and store them in list container Trip
Citi[i] name of city
Distance[i]= The distance from previous stop should approximately 500 miles
e. Output the entire list Trip after populating with 10 stops (City Name, distance traveled)
f. Calculate the total distance covered
g. insert into list Trip a new Node(Shanghai,5050) after the 4th location member function insert()
h. Output the entire list Trip after inserting the latest Node
i. Remove the 2nd location using erase() member function
j. Output the entire list Trip after removal
k.-------------------------------------
l. Now that you have this program working, template the program to handle (string, int)
m. Instantiate the version and demonstrate that it produces the same results as above
n. After ensuring that templated version works for , use the program to instantiate the
sequencing of DNA
o. Create a list of Nodes DNA empty DNA list
p. Insert the following nucleotides (Nodes) into DNA use push_front()
(A,0),(G,7),(A,4),(T,5),(G,8),(C,13),(A,4),(C,2)
q. Calculate the total length of DNA
r. Output the entire populated list container - DNA
s. insert into DNA new Node(X,5) after the 4th location member function insert()
t. Output the updated list DNA
u. Remove the 4th node
v. Output the updated list DNA
w. Calculate updated total length of DNA

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

Students also viewed these Databases questions

Question

LO 30-3 How can we adjust to death?

Answered: 1 week ago

Question

Explain the pages in white the expert taxes

Answered: 1 week ago