I'm very new to programming. I'm currently taking Introduction to Programming and my assignment was to create a fictional restaurant with food items and such. I've gotten everything to work the way the spec requires except I can't quite figure out how to calculate and print the number of selections of each menu at the end of the program.
Here's what I have so far:
Code:
#include <stdio.h>
#include <stdlib.h>
#define HAMBURGER 2.0
#define CHEESEBURGER 2.25
#define BURGER_BACON_MANIA 3.5
#define FRIES 2.0
#define CHEESE_FRIES 2.75
#define SODA 2.0
#define APPLE_CRISP_DELIGHT 3.0
main() {
double totalPrice = 0;
int choice = 0;
printf("\nWelcome to Big Bangin' Burger Hut! How may I take your order?\n");
do {
//output the menu
printf("\nBBB Hut Menu\n");
printf("1. Hamburger $%.2lf \n", HAMBURGER);
printf("2. Cheeseburger $%.2lf \n", CHEESEBURGER);
printf("3. Burger Bacon Mania $%.2lf \n", BURGER_BACON_MANIA);
printf("4. Fries $%.2lf \n", FRIES);
printf("5. Cheese Fries $%.2lf \n", CHEESE_FRIES);
printf("6. Soda $%.2lf \n", SODA);
printf("7. Apple Crisp Delight $%.2lf \n", HAMBURGER);
printf("\n8. Complete Order \n");
scanf_s("%i", &choice);
// take action based on choice
switch (choice) {
case 1:
totalPrice += HAMBURGER;
break;
case 2:
totalPrice += CHEESEBURGER;
break;
case 3:
totalPrice += BURGER_BACON_MANIA;
break;
case 4:
totalPrice += FRIES;
break;
case 5:
totalPrice += CHEESE_FRIES;
break;
case 6:
totalPrice += SODA;
break;
case 7:
totalPrice += APPLE_CRISP_DELIGHT;
break;
case 8:
printf("Thats: ")
break;
default:
printf("\nThe selection you have chosen is NOT on the menu. Please choose another item or complete this order. \n");
break;
}
printf("\nTotal so far: $%.2lf\n", totalPrice);
} while (choice != 8);
printf("\nBig Bangin Burger Hut would like to thank you for your order. Your order total is $%.2lf\n", totalPrice);
system("pause");
}
At the end, I have to calculate the number of selections of each of the items that the user has selected. So if the user selected 2 hamburgers, 1 cheese burger and a soda, I have to be able to make the program calculate and print:
"That's: 2 Hamburgers
1 Cheeseburger
1 Soda
(followed by)
Your order total is___.
How do I get the program to calculate and print the number of selections for the items? Please help!
Thanks