Question: Define a sturct called City with components fname ( type string ) , lname ( type string ) , id ( type int ) ,
Define a sturct called City with components fname type string lname type string id type int and
cost type floatthe cost of a bus ticket to travel to the city
Define a class called Journey with private numberOfCities type int a pointer of type City,
totalCost type float and the function find Cost The class has the public member functions set
a parameterized constructor with a default value as the number of cities, and a destructor.
Implement the member functions, enforcing the principle of least privileged. Define and use three files
drivercpp JourneyImp.cpp and Journey.h
The following driver produces the given sample of the output:
int main
Journey Seeran;
Seeran.print;
Seeran.set;
Seeran.print;
return ;
Sample inputoutput:
The journey involves visiting the following citycities:
First name: Ali Last name: Omar ID: at a travel cost: Dirham
The total cost of the journey is
Enter the fname, lname id and travel cost of citycities:
Aisha
Ali
Ahmed
Omar
Sama
Ahmed
The journey involves visiting the following citycities:
First name: Aisha Last name: Ali ID: at a travel cost: Dirham
First name: Ahmed Last name: Omar ID: at a travel cost: Dirham
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
