So, my display suppose to look like this... And I don't know what I'm doing.
Enter pizza size 1: Junior
Enter Number of Junior dough used today: 4
Enter pizza size 2: Regular
Enter Number of Regular dough used today: 7
Enter pizza size 3: Large
Enter Number of Large dough used today: 17
Please enter a number less than or equal to 15: 15.
Enter pizza size 4: Party
Enter Number of Party dough used today: 9
Junior:
4 Junior pizzas were sold.
$6.00 was made on Junior pizzas today.
Regular:
7 Regular pizzas were sold.
$21.00 was made on Regular pizzas today.
Large:
15 Large pizzas were sold.
$75.00 was made on Large pizzas today.
Party:
9 Party pizzas were sold.
$90.00 was made on Party pizzas today.
The total profit for the day is: $192.00
This is what I have right now.
|
v
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
// Declare the constants
const double JUNIOR_PIZZA_COST = 1.50;
const double REGULAR_PIZZA_COST = 3.00;
const double LARGE_PIZZA_COST = 5.00;
const double PARTY_PIZZA_COST = 10.00;
const int FOUR = 4;
const int FIFTEEN = 15;
// Prototype for function
void pizzasize();
int main()
{
// Prototype will be displayed
pizzasize();
// End of program.
system("pause");
return 0;
}
void pizzasize()
{
// Declare the variables
const string PIZZA_SIZES[] = { "Junior", "Regular", "Large", "Party" };
const int DOUGH_MAX[] = { 15,15,15,15 };
string size;
int numSold = 0;
double nightsProfit = 0;
for (int i = 0; i < FOUR; i++)
{
do
{
cout << "Enter pizza size " << (i + 1) << ": ";
cin >> size;
cout << "Enter Number of Junior dough used today: ";
cin >> numSold;
cout << endl;
if ((numSold + i) < 0)
{
cout << "No negative number can be entered. Try again." << endl;
}
else if ((numSold + i) > FIFTEEN)
{
cout << "Please enter a number less than or equal to 15." << endl;
}
} while ((numSold + i) < 0 || (numSold + i) > FIFTEEN);
}
for (int i = 0; i < FOUR; i++)
{
cout << "Pizza name/size: " << PIZZA_SIZES << endl;
cout << "Number sold: " << numSold << endl;
cout << "Total profit: $" << nightsProfit << endl;
nightsProfit += (numSold + i);
cout << "Total profit for the day is: $" << nightsProfit << endl;
// Goodbye message.
cout << "Thank you for your business!";
}
}
| |
Thank you in advance.