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 float)(the cost of a bus ticket to travel to the city).
Define a class called Journey with private numberOfCities (type int),p a pointer of type City,
totalCost (type float), and the function find Cost(). The class has the public member functions set(),
pr(), a parameterized constructor with a default 1 value as the number of cities, and a destructor.
Implement the member functions, enforcing the principle of least privileged. Define and use three files
(driver.cpp, JourneyImp.cpp, and Journey.h).
The following driver produces the given sample of the output:
int main()
{
Journey Seeran;
Seeran.print();
Seeran.set(3);
Seeran.print();
return 0 ;
}
Sample input/output:
The journey involves visiting the following 1 city|cities:
||First name: Ali ||||Last name: Omar ||||ID: 101314|||| at a travel cost: 10 Dirham ||
The total cost of the journey is 10
Enter the fname, lname, id and travel cost of 3 city|cities:
Aisha
Ali
654789
100
Ahmed
Omar
987123
120
Sama
Ahmed
345612
90
The journey involves visiting the following 3 city|cities:
||First name: Aisha ||||Last name: Ali ||||ID: 654789|||| at a travel cost: 100 Dirham ||
||First name: Ahmed ||||Last name: Omar ||||ID: 987123|||| at a travel cost: 120 Dirham ||
 Define a sturct called City with components fname (type string), lname

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!