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

Write a program to control a bread machine. Allow the user to input type of brea

ID: 3725437 • Letter: W

Question

Write a program to control a bread machine. Allow the user to input type of bread as W for White and S for Sweet. Ask the user if the loaf size is double and if the baking is manual. The following table details the time chart for the machine for each bread type. Display a statement for each step. If the loaf size is double, increase the baking time by 50%. If the baking is manual, stop after the loaf-shaping cycle and instruct the user to remove the dough for manual baking. Use functions to display instructions to the user and to compute the baking time. Bread Time Chart

Operation White Bread Sweet Bread

Primary kneading 15 minutes 20 minutes

Primary rising 60 minutes 60 minutes

Secondary kneading 18 minutes 33 minutes

Secondary rising 20 minutes 30 minutes

Loaf shaping 2 seconds 2 seconds

Final rising 75 minutes 75 minutes

Baking 45 minutes 35 minutes

Cooling 30 minutes 30 minutes Requirements:

• Use one function to display instructions and compute baking time

o Pass by value all variables needed

• Great documentation

• Use if and switch statements

o Switch would be ideal for choosing White or Sweet Bread

o If for baking time based on double, and manual vs baking.

Pseudocode hints:

//preprocessor //main()

//Declarations

//Gather input in main

//display and compute pass by value all input values

Explanation / Answer

Program: (pseudo code )

#include <stdio.h>

#include<conio.h>

char gettype();

char getdouble();

char getmanual();

void print(char,char,int,int,int,int,int,int,int,int);

int main()

{char type,doubleloaf,manual;

type=gettype();

if(type!='X')

    {doubleloaf=getdouble();

    if(doubleloaf!='X')

        {manual=getmanual();

          if(manual!='X')

            if(type=='S')

               print(doubleloaf,manual,20,60,33,30,2,75,35,30);

            else

                print(doubleloaf,manual,15,60,18,20,2,75,45,30);

             

        }

   }

getch();

}

char gettype()

{char type;

printf("Enter Bread Type: W for White, S for sweet ");

scanf("%c",&type);

fflush(stdin);

if(type!='S'&&type!='W')

     {printf("Invalid Bread Type-Can't use thisMachine ");

      return 'X';

     }

else

    return type;

}

char getdouble()

{char type;

printf("Enter Loaf Size: S for Single, D for Double ");

scanf("%c",&type);

fflush(stdin);

if(type!='S'&&type!='D')

     {printf("Invalid Loaf Size-Can't use thisMachine ");

      return 'X';

     }

else

    return type;

}

char getmanual()

{char type;

printf("Enter Baking Type: M for Manual, B for BreadMachine ");

scanf("%c",&type);

fflush(stdin);

if(type!='M'&&type!='B')

     {printf("Invalid Baking Type-Can't usethis Machine ");

      return 'X';

     }

else

    return type;

}

void print(char d,char m,int pk,int pr,int sk,int sr,int ls,intfr,int b,int c)

{printf(" Operating Times ");

printf("Operation            Time ");

printf("Primary Kneading   %4d mins ",pk);

printf("Primary rising     %4d mins ",pr);

printf("Secondary kneading %4d mins ",sk);

printf("Secondary rising   %4d mins ",sr);

printf("Loaf shaping       %4dseconds ",ls);

if(m=='M')

      printf("Remove dough for manualbaking ");

else

     {printf("Finalrising       %4d mins ",fr);

     if(d=='D')

         b*=2;

     printf("Baking            %4d mins ",b);

     printf("Cooling           %4d mins ",c);

      }

}

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