Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C program to help a HiFi’s Restaurant automate its breakfast billing sys

ID: 3623526 • Letter: W

Question

Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items:

a. Show the customer the different breakfast items offered by the HiFi’s Restaurant.
b. Allow the customer to select more than one item from the menu.
c. Calculate and print the bill to the customer.
d. Produce a report to present your complete program and show more sample output.

Assume that the HiFi’s Restaurant offers the following breakfast menu:

Plain Egg $2.50
Bacon and Egg $3.45
Muffin $2.20
French Toast $2.95
Fruit Basket $3.45
Cereal $0.70
Coffee $1.50
Tea $1.80

Your program must do the following task below:

a. Define the data structs, menu item types with two components: menu item of type string and menu price of type double. Use an array to declare the data structs.
b. Function get data to loads the data into the array menu list.
c. Function show menu to show the different breakfast items offered by the restaurant and tell the user how to select the items.
d. Function print receipt to calculates and prints the customer receipt. The billing amount should include a 5% tax.
e. Format your output with two decimal places. The name of each item in the output must be left-justify. You may assume that the user selects only one item of a particular type.
f. The two sample output as shown:

Welcome to HiFi’s Restaurant
1 Bacon and Egg $3.45
1 Muffin $2.20
1 Coffee $1.50
Tax 5% $0.35
Amount Due $7.50


Welcome to HiFi’s Restaurant
1 French Toast $2.95
1 Fruit Basket $3.45
2 Tea $3.60
Tax 5% $0.50
Amount Due $10.50
-------------------------------------------------------------------------------------------------------
my try
but failed
#include <stdio.h>
#include <conio.h>
#define tax 0.05


struct jitemenu{
char menitem[10];
double harga[10];
}menu[100];

void items(int ,int,double,double); // pengistiharan function
void tunjukmenu();
void resit(int, double, double, double);

int main()
{
int Q[10], item,i,c;
tunjukmenu();


void items(int item,int Q[10],double harga ,double total);

while ( item != 9 || item <=8)
{
printf("Please enter a Item No. : ");
scanf("%d", &item);

if (item != 9 || item <=8)
{
printf("Berapa unit? : ");
scanf("%d", &Q[item]);
++i;
}
}

for(c=0;c<i;c++)
{
void resit(int item, double total, double totax, double jumlah);
}

}
void tunjukmenu()
{

printf("Selamat datang ke Hifi's Restaurant ");
printf("************************************** ");
printf("1. Plain Egg $2.50 ");
printf("2. Bacon and Egg $3.45 ");
printf("3. Muffin $2.20 ");
printf("4. French Toast $2.95 ");
printf("5. Fruit Basket $3.45 ");
printf("6. Cereal $0.70 ");
printf("7. Coffee $1.50 ");
printf("8. Tea $1.80 ");
printf("9. Selesai dan print resit ");
}
void resit(int item, double total, double totax, double jumlah)
{
int Q[item];
totax=total*tax;

jumlah= totax+total;
printf("Welcome to HiFi's Restaurant ");
printf("%d %s $%lf",Q[item],menu.menuitem[item],(float)Q[item]*menu.harga[item]);
printf("Tax 5% %2.2lf",totax);
printf("Amount Due %2.2lf ",jumlah);

printf("jumlah keseluruhan %0.2lf",jumlah);
}

void items(int item,int Q[10], double harga,double total)
{

switch(item)
{
case 1:harga+=2.50*Q[item];menu.menitem[item]="Plain Egg";menu.harga[item]=2.50;
case 2:harga+=3.45*Q[item];menu.menitem[item]="Bacon and Egg";menu.harga[item]=3.45;
case 3:harga+=2.20*Q[item];menu.menitem[item]="Muffin";menu.harga[item]=2.20;
case 4:harga+=2.95*Q[item];menu.menitem[item]="French Toast";menu.harga[item]=2.95;
case 5:harga+=3.45*Q[item];menu.menitem[item]="Fruit Basket";menu.harga[item]=3.45;
case 6:harga+=0.70*Q[item];menu.menitem[item]="Cereal";menu.harga[item]=0.70;
case 7:harga+=1.50*Q[item];menu.menitem[item]="coffee";menu.harga[item]=1.50;
case 8:harga+=1.80*Q[item];menu.menitem[item]="Tea";menu.harga[item]=1.80;
case 9:total+=harga;
default:printf("input tidak sah!masukkan item yang tersenarai pada menu sahaja===>");

}
}


Explanation / Answer

please rate - thanks

#include<conio.h>
#include<string.h>
#include<stdio.h>
struct menuItemType
{char menuItem[15];
double menuPrice;  
}menuList[]={"plain egg",2.50,
             "bacon and egg",3.45,
             "muffin",2.20,
             "french toast",2.95,
              "fruit basket",3.45,
              "cereal",0.70,
              "coffee",1.50,
              "tea",1.80
              },order[10];
void getdata(struct menuItemType[],struct menuItemType[],int*);
void showMenu(struct menuItemType[],int);
void printCheck(struct menuItemType[],int );
int main()
{
int items=0;

printf("Welcome to HiFi's Restaurant My menu      Item      price ");
showMenu(menuList,8);
getdata(menuList,order,&items);
printCheck(order,items);
getch();
return 0;
}
void printCheck(struct menuItemType order[],int items)
{int i;
double total=0,tax;
printf("Your Check Ordered Items      Item      price ");
showMenu(order,items);
for(i=0;i<items;i++)
     total+=order[i].menuPrice;
printf(" Item total    $%.2f ",total);
tax=total*.05;
printf("Tax $%.2f ",tax);
printf("Amount Due    $%.2f ",total+tax);
}
void getdata(struct menuItemType menu[],struct menuItemType order[],int* items)
{char yesno='Y',garbage;
int n;
while(toupper(yesno)=='Y')
{printf("Enter your order item number: ");
scanf("%d",&n);
while(n<1||n>8)
    {printf("invalid item number ");
     printf("Enter your order item number: ");
     scanf("%d",&n);
     }
//order[*items].menuItem=menu[n-1].menuItem;
strcpy(order[*items].menuItem,menu[n-1].menuItem);
order[*items].menuPrice=menu[n-1].menuPrice;
*items=*items+1;
scanf("%c",&garbage);
printf("Would you like another item?(y/n)? ");
scanf("%c",&yesno);
}
}
void showMenu(struct menuItemType a[],int n)
{int i;

    for(i=0;i<n;i++)
         printf("%d. %-16s$%.2f ",i+1,a[i].menuItem,a[i].menuPrice);
       
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote