Question

03 (20 Marks) A pastry cook is preparing special dishes for her daughters birthday. It takes her a minutes to prepare the fi

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

//C++ CODE save it as filename.cpp

#include <iostream>

using namespace std;
int main(){
   int a, b , t;
   cout<<"Enter the number of minutes to prepare first dish: ";
   cin>>a;
   cout<<"Enter how many more minutes to prepare the next dish: ";
   cin>>b;
   cout<<"Enter the total time (in minutes) to prepare all the dishes: ";
   cin>>t;
   int number_of_dishes = 0;
   int remaining = t;
   int current_time = a;
   while(1){
       if(remaining>=current_time){
           number_of_dishes++;
           remaining = remaining - current_time;
           current_time = current_time + b;

       }else{
           break;
       }
   }
   cout<<"In "<<t<<" minutes(s) the pastry cook can prepare "<<number_of_dishes<<" dishes with "<<remaining<<" minutes unused.";
   return 0;
}

// Run as g++ filename.cpp

// ./a.out

Enter the number of minutes to prepare first dish: 6 Enter how many more minutes to prepare the next dish: 4 Enter the total

Add a comment
Know the answer?
Add Answer to:
03 (20 Marks) A pastry cook is preparing special dishes for her daughter's birthday. It takes...
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
  • Objectives: (You must use loop structures to get credit for this assignment) Students in Norfolk Gardens...

    Objectives: (You must use loop structures to get credit for this assignment) Students in Norfolk Gardens Academy are very excited about the end of year school party. Victoria is playing piano. She is practicing for the end of the school year party every day for a certain amount of time depending on her schedule. It takes her N minutes to practice the first song, and each of following songs takes M minutes longer than the previous song. She has T...

  • c/c++ Passing arrays as arguments to functions. The main() is given, write the function 'average' (Study...

    c/c++ Passing arrays as arguments to functions. The main() is given, write the function 'average' (Study the syntax of passing an array as a function parameter) The program prompts the user to first enter the number of tests given in a course, and then prompts him/her to enter the mark for each test. The marks are stored in an array. This takes place in the main() function. It then passes the array to a function named 'average' that calculates and...

  • Alaska Airlines: 20-Minute Baggage Process-Guaranteed! Video Case Alaska Airlines is unique among the nine major U.S....

    Alaska Airlines: 20-Minute Baggage Process-Guaranteed! Video Case Alaska Airlines is unique among the nine major U.S. carriers not only for its extensive flight coverage of remote towns throughout Alaska (it also covers the U.S., Hawaii, and Mexico from its pri mary hub in Seattle). It is also one of the smallest independent airlines, with 10,300 employees, including 3,000 flight attendants and 1,500 pilots. What makes it really unique, though, is its abil- ity to build state-of-the-art processes, using the latest...

  • please urgent help needed lakt time measure which b. I Discussion Questions ( Why Is It...

    please urgent help needed lakt time measure which b. I Discussion Questions ( Why Is It portant to look a formance, as measured by average Inventory avera e gate flow pe flow time, and average throughput? 3.2 Discuss why it is often easier to measure average inventory and average throughput rather than aver- age flow time How can a manager determine the minimal set of operational measures that should be tracked on a daily basis to predict the financial performances...

  • please use python and provide run result, thank you! click on pic to make it bigger...

    please use python and provide run result, thank you! click on pic to make it bigger For this assignment you will have to investigate the use of the Python random library's random generator function, random.randrange(stop), randrange produces a random integer in the range of 0 to stop-1. You will need to import random at the top of your program. You can find this in the text or using the online resources given in the lectures A Slot Machine Simulation Understand...

  • photos for each question are all in a row (1 point) In the following questions, use...

    photos for each question are all in a row (1 point) In the following questions, use the normal distribution to find a confidence interval for a difference in proportions pu - P2 given the relevant sample results. Give the best point estimate for p. - P2, the margin of error, and the confidence interval. Assume the results come from random samples. Give your answers to 4 decimal places. 300. Use 1. A 80% interval for pı - P2 given that...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

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