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

you have been requested by a restaurant to track 3 of their dishes. you talk to

ID: 655407 • Letter: Y

Question

you have been requested by a restaurant to track 3 of their dishes. you talk to the chef and determine the following is required:

1. Data: (These must be entered for each dish)

Name of Dish

Quantity of Main Ingredient (in ounces)

Dish's Quantity of Liquid (in ounces)

Cost of Preparing Dish

2. Calculate the size of Pot (in quarts) necessary to cook dish (3 calculations)

Size of Pot (in quarts) = (Quantity of Liquid + Quantity of Main Ingredient)/32 ounces

3. Calculate the Average cost per meal (1 calculation)

Average Cost Per Dish = Sum of Costs Per Dish/Number of Dishes Entered

4. Categorize the size of the Pot needed for the 3 dishes according to the following:  (if statement)

a. If Pot is < 1 quart then it is Small

b. If Pot is < 4 quarts then it is Medium

c. If Pot is < 12 quarts then it is Large

d. If Pot is >= 12 quarts then it is Extra Large

5. Calculate the restaurant

Explanation / Answer

/*main function*/

void main ()

{

   struct DISH dish[10];

   int i, n,totalingredient;

   double averagecost;

   double totalcost=0,revenue;

   clrscr();

   printf(" how many dishes do u want:");

   scanf("%d",&n);

   for(i=0;i<n;i++)

   {

     printf("enter Dish name");

     scanf("%s",dish[i].dishname);

     printf("enter ingredients quantity");

     scanf("%d",&dish[i].ingredient_qty);

     printf("enter quantity of liquid used for the dish");

     scanf("%d",&dish[i].liquidqty);

     printf("cost per meal");

     scanf("%.2f",&dish[i].cost);

     }

for(i=0;i<n;i++)

   {

     dish[i].potsize = (dish[i].liquidqty + dish[i].ingredient_qty) / 32;

   }

for(i=0;i<n;i++)

   {

     totalcost=totalcost+dish[i].cost;

   }

Averagecost = totalcost/n;

for(i=0;i<n;i++)

   {

    if(dish[i].potsize<1)

      {

   strcpy(dish[i].pottype,"small");

}

     else if(dish[i].potsize<4)

     {

        strcpy(dish[i].pottype,"Medium");

     }

     else if(dish[i].potsize<12)

     {

        strcpy(dish[i].pottype,"Large");

     }

     else if(dish[i].potsize>=12)

     {

      strcpy(dish[i].pottype,"Extra Large");

     }

}

for(i=0;i<n;i++)

{

Totalingredient = totalingredient+dish[i].ingredient_qty;

}

revenue=(.50*totalingredient)-(averagecost*n);

printf(" Name of Dish Main Qty Liquid Qty Cost Potsize");

for(i=0;i<n;i++)

{

printf(" %s %d %d %f %s",dish[i].dishname,dish[i].ingredient_qty,dish[i].liquidqty,dish[i].cost,dish[i].pottype);

}

printf(" Average Cost of meals: %f",averagecost);

printf(" Revenue %f",revenue);

getch();

}