Question: C++ Modify the program so that it uses two void functions : one to calculate the price of a medium pizza and the other to

C++

Modify the program so that it uses two void functions : one to calculate the price of a medium pizza and the other to calculate the price of a large pizza. In addition to the $2 coupon on the purchase of a large pizza, Sophia is now emailing customers a $1 coupon on the purchase of a medium pizza. Test the program appropriately.

#include #include using namespace std;

int main() { char size = ' '; char coupon = ' '; double price = 0.0; cout << "M(edium or L(arge pizza? "; cin >> size; size = toupper(size);

if (size != 'M' && size != 'L') cout << "Please enter either M or L. " << endl; else { if (size == 'M') price = 9.99; else { price = 12.99; cout << "$2 dollar coupon (Y/N)? "; cin >> coupon; if (toupper(coupon) == 'Y') price -= 2;

} cout << fixed << setprecision(2); cout << "Price: $" << price << endl; } system("pause"); return 0; }

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!