You are using a version without Ads of this website. Please, consider donating:

### HELP!

A restaurant has 3 lunch combos for customers to choose:
Combo A: Fried chicken with coleslaw [price: 6.00]
Combo B: Roast beef with mashed potato [price: 6.25]
Combo C: Fish and chips [price: 5.75]

Write a program to calculate how much a group of customers should pay. The program first asks how many customers there are in the group. Then it asks the combo ordered by each customer. If case a customer does not want to order anything, the cashier will enter X, which means order nothing, into the program. When every customer in the group has placed his/her order, the program will display the number of each combo ordered and the total amount of this groupâ€™s bill.

Here is my code. I am failing miserably.

 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 #include using namespace std; int main() { int customers = 0; char combo = ' '; int comboA = 0; double comboAprice = 0.0; int comboB = 0; double comboBprice = 0.0; int comboC = 0; double comboCprice = 0.0; int comboX = 0; double comboXprice = 0.0; double aDue = 0.0; cout << "How many customers are in your group? "; cin >> customers; for (int counter = customers; counter = customers; counter = customers) { cout << "What combo would you like (A,B,C)? "; cin >> combo; combo = toupper(combo); switch (combo) { case 'A' : comboA = comboA + 1; comboAprice = comboA * 6.00; break; case 'B' : comboB = comboB + 1; comboBprice = comboB * 6.25; break; case 'C' : comboC = comboC + 1; comboCprice = comboC * 5.75; break; case 'X' : comboX = comboX + 1; comboXprice = comboX * 0.00; } } aDue = comboAprice + comboBprice + comboCprice; cout << "Number of Combo A order: " << comboA << endl; cout << "Number of Combo B order: " << comboB << endl; cout << "Number of Combo C order: " << comboC << endl; cout << "Total amount due: " << aDue << endl; system ("pause"); return 0; }
Last edited on
On line 22, your for loop syntax is incorrect.
For loops follow the pattern for(variable, condition, increment).
Your variable, counter, should begin at 0.
Your loop should continue while counter is less than customers; loop once per customer.