Answered step by step
Verified Expert Solution
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 Trip Nodes and store them in list container Trip
Citii name of city
Distancei The distance from previous stop should approximately miles
e Output the entire list Trip after populating with stops City Name, distance traveled
f Calculate the total distance covered
g insert into list Trip a new NodeShanghai after the th location member function insert
h Output the entire list Trip after inserting the latest Node
i Remove the nd 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 pushfront
AGATGCAC
q Calculate the total length of DNA
r Output the entire populated list container DNA
s insert into DNA new NodeX after the th location member function insert
t Output the updated list DNA
u Remove the th 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
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