Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your Task Recreate the Pizza Express Pizza Wizard app as demonstrated below. You will use three decisions (if/else if/else) to capture the users choices and
Your Task
Recreate the Pizza Express Pizza Wizard app as demonstrated below. You will use three decisions (if/else if/else) to capture the users choices and ultimately display the full pizza order. In the below example, user input is highlighted yellow for clarity; all other statements are output created with cout.
Welcome to Pizza Express!
Please use our Pizza Wizard app to place your order in three easy steps.
Let's begin!
Step 1: Choose your pizza size:
1) 6-inch (Personal) - $6.95
2) 12-inch (Dinner for Two) - $12.95
3) 18-inch (Family-Sized) - $19.95
Enter your option (1-3) =======> 2
Step 2: Choose your protein:
1) Sausage - $2.95
2) Pepperoni - $1.95
3) Diced Tofu - $2.95
Enter your option (1-3) =======> 3
Step 3: Choose your vegetable:
1) Green Pepper - $1.50
2) Mushrooms - $.50
3) Black Truffle - $14.95
Enter your option (1-3) =======> 3
PIZZA EXPRESS ORDER CONFIRMATION
--------------------------------
12.95 12-inch (Dinner for Two)
2.95 Diced Tofu
14.95 Black Truffle
Total: $30.85
Thank you for your order!
Requirements and Considerations
Use the following preprocessor directives:
#include
#include
#include
using namespace std;
You will have to create variables to keep track of the users options and as well the various price points. I suggest the following:
int userChoice = 0;
string strSize = "", strProtein = "", strVeg = "";
float baseCost = 0, proteinCost = 0, vegCost = 0, totalCost = 0;
Heres some pseudo-code (not actual code except for the structure of the if/else if/else) to get you thinking about your decision strategy:
if (userChoice == 1) //6-inch personal size NOTE DOUBLE EQUAL SIGN!
{
//capture size as string (e.g., "6-inch (Personal)") in strSize variable;
//capture base cost as number (e.g., 6.95)
}
else if (userChoice == 2) //12-inch
{
//capture size as string (e.g., "12-inch (Dinner for Two)") in strSize variable;
//capture base cost as number (e.g., 12.95)
}
else//18-inch family size
{
//capture size as string (e.g., "18-inch (Family Size)") in strSize variable;
//capture base cost as number (e.g., 19.95)
}
You will make three decisions in this program: one each for size, protein, and vegetable. This means youll have three separate if/else if/else structures in this program.
Do NOT try to use nested if statements (an if inside an if) in this program.
You do NOT need to worry about the user entering invalid input (though youre welcome to play around with possible solutions if you like).
Use the tab escape sequence (\t) to get column spacing in the final order confirmation:
cout << proteinCost << "\t" << strProtein << endl;
Use cout << fixed << showpoint << setprecision(2) to display the prices to two decimals. The dollar sign at the end is hardcoded:
cout << "Total: $" << totalCost << endl;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started