
Patrick B. answered 07/22/21
Math and computer tutor/teacher
using namespace std;
#include <iostream>
#include <string>
#include <iomanip>
#define PRICE_GYRO (7.00f)
#define PRICE_MOUSSAKA (8.50f)
#define PRICE_SALAD ( 3.75f)
#define PRICE_DOLMA (2.00f)
#define PRICE_SODA (2.80f)
#define PRICE_COFFEE (1.00f)
#define PRICE_WATER ( 2.00f)
int Menu()
{
int x;
cout << "--------------------------------------------" << endl;
cout << " (1) GYRO " << PRICE_GYRO << endl;
cout << " (2) MOUSSAKA " << PRICE_MOUSSAKA << endl;
cout << " (3) SALAD " << PRICE_SALAD << endl;
cout << " (4) DOLMA " << PRICE_DOLMA << endl;
cout << " (5) SODA " << PRICE_SODA<< endl;
cout << " (6) COFFEE " << PRICE_COFFEE << endl;
cout << " (7) WATER " << PRICE_WATER << endl;
cout << " (0) END ORDER " << endl;
cout <<"------------------------------------------------" << endl;
cout << "Input selection :>";
cin >>x;
return x;
}
Go()
{
int numGyro=0;
int numMoussaka=0;
int numSalad=0;
int numDolma=0;
int numSoda=0;
int numCoffee=0;
int numWater=0;
int iMenuResult=-1;
do
{
iMenuResult = Menu();
switch (iMenuResult)
{
case 1: { numGyro++; break; }
case 2: { numMoussaka++; break; }
case 3: { numSalad++; break; }
case 4: { numDolma++; break; }
case 5: { numSoda++; break; }
case 6: { numCoffee++; break; }
case 7: { numWater++; break; }
} //switch
double subtotal = 0;
double total=0;
cout << "Item qty price subtotal " << endl;
cout << "-------------------------------------------" << endl;
if (numGyro>0)
{
subtotal = numGyro * PRICE_GYRO;
total += subtotal;
cout << "GYRO " << numGyro << " " << setprecision(2) << fixed << PRICE_GYRO
<< " " << setprecision(2) << fixed << subtotal << endl;
}
if (numMoussaka>0)
{
subtotal = numMoussaka * PRICE_MOUSSAKA;
total += subtotal;
cout << "Moussaka " << numMoussaka << " " << setprecision(2) << fixed << PRICE_MOUSSAKA
<< " " << setprecision(2) << fixed << subtotal << endl;
}
if (numSalad>0)
{
subtotal = numSalad * PRICE_SALAD;
total += subtotal;
cout << "Salad " << numSalad << " " << setprecision(2) << fixed << PRICE_SALAD
<< " " << setprecision(2) << fixed << subtotal << endl;
}
if (numDolma>0)
{
subtotal = numDolma * PRICE_DOLMA;
total += subtotal;
cout << "Dolma " << numDolma<< " " << setprecision(2) << fixed << PRICE_DOLMA
<< " " << setprecision(2) << fixed << subtotal << endl;
}
if (numSoda>0)
{
subtotal = numSoda * PRICE_SODA;
total += subtotal;
cout << "Soda " << numSoda<< " " << setprecision(2) << fixed << PRICE_SODA
<< " " << setprecision(2) << fixed << subtotal << endl;
}
if (numCoffee>0)
{
subtotal = numCoffee * PRICE_COFFEE;
total += subtotal;
cout << "Coffee " << numCoffee<< " " << setprecision(2) << fixed << PRICE_COFFEE
<< " " << setprecision(2) << fixed << subtotal << endl;
}
if (numWater>0)
{
subtotal = numWater * PRICE_WATER;
total += subtotal;
cout << "WATER " << numWater<< " " << setprecision(2) << fixed << PRICE_WATER
<< " " << setprecision(2) << fixed << subtotal << endl;
}
cout <<"-------------------------------------------------------------" << endl;
cout << "Total is " << setprecision(2) << fixed << total << endl;
} while (iMenuResult!=0);
}
int main()
{
Go();
}
//******************************************************************************************************************
//*****************************************************************************************************************

Patrick B.
there ya go...07/23/21
Malik A.
I am studying CIS 1111, we didn't take all that you did07/23/21