Problem 2 of 3: Cake Calculator
After your success with conversions in your chemistry class, one of your good friends asks you to participate as their aide in a baking competition. For the competition, your team will have to bake a cake and ice it, and do not yet know how many servings the cake will yield. You and your friend are following a basic cake recipe for 12 servings which results in a round (cylindrical) cake with a radius of 4 inches and a height of 2 inches and plan to scale this based on the number of servings required at the competition. Your team is only allowed to make a 2-inch-tall cake but can vary the radius of the cake as needed. Your team will only ice the circular top of the cake and will need 0.25 in³ of icing for every 1 in² of cake surface area. Create MATLAB code that will take a user-entered amount of servings and output the volume and radius of the cake your team will need to make and the amount of icing needed to cover the top of it.
Your program should:
- Request a user input for the number of servings required
- Calculate the volume (inÂł) needed for the cake your team will make
- Calculate the radius (in) and surface area (in²) of the top of the cake for the cake your team will make
- Tip: MATLAB uses 'pi' as a preloaded variable name for π
- Calculate the amount of icing needed to ice the circular top of the cake
- Output:
1) The number of servings needed according to the user
2) The volume of the cake your team will make
3) The radius of the cake your team will make
4) The amount of icing needed
- Do not forget to include units and descriptions.
Create a sample run for 48 servings.
Problem 2
User input for the number of servings required
servings = input("Please input the number of servings needed")
Calculations for volume and radius of cake, surface area of top of the cake, and icing needed
Requested outputs