Question

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

Write a program to control a bread machine. Allow the user to input the 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 program should fail if the user inputs are invalid. The following table is a time chart for the machine used for each bread type. Print a statement for each step. If the loaf size is double, increase the baking time by 50 percent. If baking is manual, stop after the loaf-shaping cycle and instruct the user to remove the dough for manual baking. Use a function to print program instructions.

Time Chart for Making Bread

Primary kneading 15 mins 20 mins

Primary rising 60 mins 60 mins

Secondary kneading 18 mins 33 mins

Secondary rising 20 mins 30 mins

Loaf shaping 2 seconds 2 seconds

Final rising 75 mins 75 mins

Baking 45 mins 35 mins

Cooling 30 mins 3 0 mins

C++

sample output

enter loaf size d <-- double n <-- normal:d

enter baking process M <-- Manual, A <-- Automatic: A

primary kneading--> 20 mins

primary rising --> 60 mins

secondary kneading --> 33 mins

secondary rising --> 30 mins

loaf shape -->2

final rising --> 75 mins

bake for 52 mins 30 sec

cool for 30 mins

0 0
Add a comment Improve this question Transcribed image text
Answer #1

please do upvote.If you have any problem do comment and i shall be happy to help you.Thanks for using HomeworkLib.

---------------------------

#include<iostream>
#include<string>
using namespace std;

//function to get input
void get_input(string& type,string& loaf_size,string& baking_process)
{

   cout << "enter type of bread w<---white s<----sweet: ";
   cin >> type;

   cout << "enter loaf size d<---double n<----normal: ";
   cin >> loaf_size;

   cout << "enter baking process m<----manual a<-----automatic: ";
   cin >> baking_process;


}


int main()
{

   //time chart as 2d array
   double time[8][2] = { {15,20}, {60,60} ,{18,33}, {20,30} ,{2,2} ,{75,75} ,{45,35} ,{30,30} };


   //variable to store data
   int col = 0;
   string type;
   string loaf_size;
   string baking_process;
   string input;

   //calling funcion
   get_input(type, loaf_size, baking_process);


   //showing time
   if (type == "s")
   {
       col = 1;
   }
   else if (type == "w")
   {
       col = 0;
   }

   else
   {
       cout << "invalid input\n";
       return 0;
   }

   cout << "primary kneading----> " << time[0][col] << " mins\n";
   cout << "primary rising----> " << time[1][col] << " mins\n";
   cout << "secondary kneading----> " << time[2][col] << " mins\n";
   cout << "secondary rising----> " << time[3][col] << " mins\n";
   cout << "loaf shaping----> " << time[4][col] << " sec\n";

   if (baking_process == "m")
   {

       while (true)
       {
           cout << "enter r to remove dough for baking: ";
           cin >> input;

           if (input == "r")
           {
               break;
           }
       }
   }
   else if (baking_process == "a")
   {


   }
   else
   {
       cout << "invalid input\n";
       return 0;
   }

   cout << "final rising----> " << time[5][col] << " mins\n";


   if (loaf_size == "d")
   {

       cout << "baking ----> " << time[6][col]+(50.0/100.0)*time[6][col] << " mins\n";
   }
   else if (loaf_size == "n")
   {
       cout << "baking ----> " << time[6][col] << " mins\n";

   }
   else
   {
       cout << "invalid input\n";
       return 0;
   }
     
   cout << "cooling ----> " << time[7][col] << " mins\n";

   system("pause");//remove it if not required.it is used to prevent console in visual studio from closing

   return 0;
}

-------------------------

Add a comment
Know the answer?
Add Answer to:
Write a program to control a bread machine. Allow the user to input the type of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT