Question: Write a C++ program to calculate the cost of a trip The user will enter the way to travel (air, train, or boat), the length

Write a C++ program to calculate the cost of a trip The user will enter the way to travel (air, train, or boat), the length (days) of the trip, and if they are traveling in a standard or premium mode The base cost of the trip is $200 Traveling by the train or boat is included in the base price. Traveling by air costs an additional $150 The first 2 days are included in the base price. Each day over 2, costs an additional $100 Standard travel is included in the base price. Premium travel costs an additional $75

# include using namespace std;

const int base_cost_of_trip = 200;

int main()

{

int air;

int boat;

int train;

int numDays;

int standardPrice;

int premiumPrice;

int totalPrice;

//prompt

cout << "air/train/boat: ";

cin >> air, boat, train;

cout << endl;

cout << "Enter num days: ";

cin >> numDays;

cout << endl;

cout << "Enter standard/premium: ";

cin >> standardPrice, premiumPrice;

cout << endl; cout << "price: ";

cin >> totalPrice;

cout << endl;

return 0;

}

could someone please tell me if I am writing this code correctly? and how to do the math part please. with explanation please. THANK YOU

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!