Question: hi , i want the program written in C++ , Thanks Create a class called Journey that contains the following private data members: city the

hi , i want the program written in C++ , Thanks

Create a class called Journey that contains the following private data members: city the city to which a person is traveling of type string, travelTime the number of hours to reach the city of type double, and points the number of points the traveler gets for going through that journey of type integer. The class also contains the following member functions set(), get(), print(), and calculatePoints().

The following program produces the given sample of input / output:

int main()

{

Journey traveler[arraySize];

string destination;

int numberOfJourneys, tPoints;

double time, sum=0;

cout << "Enter the number of journeys: ";

cin >> numberOfJourneys;

for(int i=0; i

{

cout << "Enter the city, and travel time: ";

cin >> destination >> time;

traveler[i].set(destination, time);

traveler[i].print();

traveler[i].get(destination, time, tPoints);

sum += tPoints;

}

cout << "The total number of points is: " << sum << endl;

return 0;

}

Note: For each hour of travel the traveler gets 20 points.

Sample Input / Output:

Enter the number of journeys: 3

Enter the city, and travel time: Cairo 4.6

The destination is: Cairo the time is: 4.6 and the points is: 91

Enter the city, and travel time: Amman 3

The destination is: Amman the time is: 3 and the points is: 60

Enter the city, and travel time: Beirot 3.7

The destination is: Beirot the time is: 3.7 and the points is: 74

The total number of points is: 225

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!