Question: PYTHON Write your first Cake Program Develop a computer program in many ways is like making a cake, from beginning to end - from design

PYTHON

Write your first "Cake Program"

Develop a computer program in many ways is like making a cake, from beginning to end - from design to preparation to processing of ingredients to baking to frosting and decoration. Every step is very involved and critical. And It requires much foresight, clear thinking and strenuous labor every step of the way. It also take experience and expansive knowledge to do a good job.

Yet, at the end of the day you are still at the mercy of those who eat your cake, friends and family or customers if you run a business. If they liked it, it is a good cake. If they didn't like it, you failed, and it doesn't matter how much time and effort you put into it and how much skills you deployed.

Now, to let this analogy sink in a bit, let's write a Cake Program, you first Cake Program.

These are what the Cake Program will do :

  1. Take an order for the type and size of the cake from the keyboard(console) interface.
  2. These are the types that can be ordered, only 3 types such that the programming scope is within manageable limits, as the lab assignment for this week:
    1. Chocolate
    2. Red Velvet
    3. Lemon
  3. For each type, the customer can choose from two sizes:
    1. Regular (4 Lb)
    2. Large (7 Lb)
  4. From the inputs gotten from above, using the recipes given here, calculate the amount of each ingredient required. You must use the recipe here!
  5. For the cake just selected, print the list of ingredients and each accompanied with the amount in Oz

Cake Recipes you must use (Don't use your own even if you truly believe yours is the best)

The amount of each ingredient has been converted to percentage of the total weight of the cake, from cups, teaspoons, etc. These are just recipes for the core of the cake without frosting yet, to keep the scope of your lab assignment here manageable. Now, you can conceive how extensive the whole business can become.

  • Chocolate Cake Recipe:
    • Flour - 15.8%
    • Sugar - 24.5%
    • Unsweetened Cocoa Powder - 5.6%
    • Baking Powder - 0.4%
    • Baking Soda - 0.6%
    • Salt - 0.4%
    • Egg - 9%
    • Buttermilk - 18.0%
    • Canola Oil - 8.1%
    • Vanilla Extract - 0.6%
    • Boiling Water - 17.0%
  • Red Velvet Cake Recipe:
    • Flour - 22.4%
    • Sugar - 22.4%
    • Baking Soda - 0.7%
    • Salt - 0.4%
    • Unsweetened Cocoa Powder - 0.4%
    • Canola Oil - 24.0%
    • Buttermilk - 17.9%
    • Egg - 9.0%
    • Red Food Coloring - 2.1%
    • Vanilla Extract - 0.3%
    • Distilled Vinegar - 0.3%
  • Lemon Cake Recipe:
    • Butter - 8.5%
    • Sugar - 15.0%
    • Egg - 9.0%
    • Sifted Self-Rising Flour - 15.6%
    • Buttermilk - 9.0%
    • Vanilla Extract - 0.2%
    • Filling:
      • Egg Yolk - 17.9%
      • Sugar - 11.3%
      • Butter - 2.1%
      • Lemon Juice and Zest - 11.4%

Here is a sample run:

Please select cake type; Enter 1 for Chocolate, 2 for Red Velvet and 3 for Lemon: 2 Please select cake size; Enter L for large, R for regular: R Regular Red Velvet Ingredient list: Flour: 12.1 Oz Sugar: 12.2 Oz Baking Soda: 10.2 Oz Salt: 0.3 Oz Unsweetened Cocoa Powder: 0.3 Oz Canola Oil: 13.0 Oz Buttermilk: 9.7 Oz Egg: 4.9 Oz Red Food Coloring: 1.2 Oz Vanilla Extract: 0.2 Oz Distilled Vinegar: 0.2 Oz

Checkpoints:

  • Follow the 3-Step approach algorithm and structure - [Input] - [Calculate] - [Output]. Try to decouple them completely, eg No arithmetic expression embedded in any print( . ) statement in the [Output] stage.
  • You should use nested if constructs
  • You have the option to put everything into one function or divide it up into multiple functions. But, you should have at least one function in your program.
  • You can add test code to check your result by adding all the ingredients weighs to get the total weight back. You should remove or comment out the test code before submission
  • Use constants to represent the ingredients percentage in the recipes
  • To limit the scope for this exercise, you don't have to add any bells and whistles to make the user interface look great, because this is a program for internal use - to assist the chef, or the automatic cake machine, to organize the material list and record the inventory draw.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!