Question: #include #define SALES_TAX 0.07 #define ITALIAN_BEEF 7.99 #define SUB_SANDWITCH 5.99 #define NACHO_SUPREME 6.99 #define MEXICAN_TACO 2.99 #define NACHO_REGULAR 4.99 #define HOT_DOG 2.99 #define SLUSHY 2.49
#include
#define SALES_TAX 0.07
#define ITALIAN_BEEF 7.99
#define SUB_SANDWITCH 5.99
#define NACHO_SUPREME 6.99
#define MEXICAN_TACO 2.99
#define NACHO_REGULAR 4.99
#define HOT_DOG 2.99
#define SLUSHY 2.49
#define MILK_SHAKE 3.49
#define ICE_CREAM 1.79
#define FOUNTAIN_DRINKS 1.00
int main()
{
int month,day,year;
month = 01;
day = 12;
year = 2023;
int selection1, selection2;
float first_item_price, second_item_price, total, discount_on_item1, discount_on_item2, total_after_discount, tax, subtotal;
first_item_price = 0;
second_item_price = 0;
total_after_discount = 0;
discount_on_item1 = 0;
discount_on_item2 = 0;
tax = 0;
subtotal = 0;
printf(" Hello,");
printf(" I'm Md Maruf Hossain.");
printf(" Welcome to my first project!");
printf(" ITS24000 Spring 2023");
printf(" Date: %d/%d/%d ",month,day,year);
printf(" ----------------------------------");
printf(" ----Welcome to GRAND FOOD!-----");
printf(" -------------Menu:----------------");
printf(" 1. Italian Beef -----> $%8.2f-", ITALIAN_BEEF);
printf(" 2. Sub Sandwitch ----> $%8.2f-", SUB_SANDWITCH);
printf(" 3. Nacho Supreme ----> $%8.2f-", NACHO_SUPREME);
printf(" 4. Mexican Taco -----> $%8.2f-", MEXICAN_TACO);
printf(" 5. Nacho Regular ----> $%8.2f-", NACHO_REGULAR);
printf(" 6. Hot Dog ----------> $%8.2f-", HOT_DOG);
printf(" 7. Slushy -----------> $%8.2f-", SLUSHY);
printf(" 8. Milk Shake -------> $%8.2f-", MILK_SHAKE);
printf(" 9. Ice Cream --------> $%8.2f-", ICE_CREAM);
printf(" 10. Fountain Drinks -> $%8.2f-", FOUNTAIN_DRINKS);
printf(" ----------------------------------");
printf(" Please enter the number of the item you would like to purchase -> ");
scanf("%d", &selection1);
switch (selection1)
{
case 1:
printf(" Your selected item is Italian Beef!");
first_item_price = first_item_price + ITALIAN_BEEF;
break;
case 2:
printf(" Your selected item is Sub Sandwitch!");
first_item_price = first_item_price + SUB_SANDWITCH;
break;
case 3:
printf(" Your selected item is Nacho Supreme!");
first_item_price = first_item_price + NACHO_SUPREME;
break;
case 4:
printf(" Your selected item is Mexican Taco!");
first_item_price = first_item_price + MEXICAN_TACO;
break;
case 5:
printf(" Your selected item is Nacho Regular!");
first_item_price = first_item_price + NACHO_REGULAR;
break;
case 6:
printf(" Your selected item is Hot Dog!");
first_item_price = first_item_price + HOT_DOG;
break;
case 7:
printf(" Your selected item is Slushy!");
first_item_price = first_item_price + SLUSHY;
break;
case 8:
printf(" Your selected item is Milk Shake!");
first_item_price = first_item_price + MILK_SHAKE;
break;
case 9:
printf(" Your selected item is Ice Cream!");
first_item_price = first_item_price + ICE_CREAM;
break;
case 10:
printf(" Your selected item is Fountain Drinks!");
first_item_price = first_item_price + FOUNTAIN_DRINKS;
break;
default:
printf(" You didn't select any of these things!");
printf(" Select between (1 to 10)! Try again!");
break;
}
printf(" ------------------------------------------------------");
printf(" We are currently having a buy one, get one off sale!");
printf(" Select your 2nd item -> ");
scanf("%d", &selection2);
switch (selection2)
{
case 1:
printf(" Your 2nd item is Italian Beef!");
second_item_price = second_item_price + ITALIAN_BEEF;
break;
case 2:
printf(" Your 2nd item is Sub Sandwitch!");
second_item_price = second_item_price + SUB_SANDWITCH;
break;
case 3:
printf(" Your 2nd item is Nacho Supreme!");
second_item_price = second_item_price + NACHO_SUPREME;
break;
case 4:
printf(" Your 2nd item is Mexican Taco!");
second_item_price = second_item_price + MEXICAN_TACO;
break;
case 5:
printf(" Your 2nd item is Nacho Regular!");
second_item_price = second_item_price + NACHO_REGULAR;
break;
case 6:
printf(" Your 2nd item is Hot Dog!");
second_item_price = second_item_price + HOT_DOG;
break;
case 7:
printf(" Your 2nd item is Slushy!");
second_item_price = second_item_price + SLUSHY;
break;
case 8:
printf(" Your 2nd item is Milk Shake!");
second_item_price = second_item_price + MILK_SHAKE;
break;
case 9:
printf(" Your 2nd item is Ice Cream!");
second_item_price = second_item_price + ICE_CREAM;
break;
case 10:
printf(" Your 2nd item is Fountain Drinks!");
second_item_price = second_item_price + FOUNTAIN_DRINKS;
break;
default:
printf(" You didn't select any of these things!");
printf(" Select between (1 to 10)! Try again!");
break;
}
total = first_item_price + second_item_price;
discount_on_item1 = discount_on_item1 + (first_item_price/2);
discount_on_item2 = discount_on_item2 + (second_item_price/2);
if( first_item_price < second_item_price)
{
total_after_discount = discount_on_item1 + second_item_price;
}
else
{
total_after_discount = first_item_price + discount_on_item2;
}
printf(" ----------------------------------");
printf(" Total: $%8.2f-", total);
printf(" ----------------------------------");
printf(" ----------------------------------");
if (first_item_price < second_item_price)
{
printf(" Discount: $%8.2f-", discount_on_item1);
}
else
{
printf(" Discount: $%8.2f-", discount_on_item2);
}
printf(" ----------------------------------");
printf(" Total after discount: $%8.2f-", total_after_discount);
printf(" ----------------------------------");
tax = total_after_discount * SALES_TAX;
printf(" Tax: $%8.2f-", tax);
printf(" ----------------------------------");
subtotal = total_after_discount + tax;
printf(" Subtotal: $%8.2f-", subtotal);
printf(" ----------------------------------");
printf(" THANK YOU! You are all set! Have a GREAT day!");
return 0;
}
how to change this code with these conditions:
Create a void function that takes no parameters to display your welcome screen
Create a void function that takes no parameters to display your store menu screen
Create a value-returning function that takes no parameters and prompts the user for a menu selection, checks for its validity and returns the item selected when valid
Create a value-returning function that takes the item selected as a parameter and returns the price of the item selected
Create a value-returning function that takes the prices of the two items selected and returns the discount they will receive
Create a void function that takes the item prices, discount, tax, and total and prints the receipt
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
