Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python The first part of this assignment is to do some calculations in order to figure out the ingredients you'll need for the wedding cake
python
The first part of this assignment is to do some calculations in order to figure out the ingredients you'll need for the wedding cake depicted in Figure 1. You will ask the user to enter the dimensions of the cake, then you'll use Python to do some calculations, and last you're going to print the results. In the second part you're trying to answer the question "What if I use the same ingredients to make a different wedding cake?. Given the exact same amount of ingredients (.e. volume) you just calculated for the first cake, you want to figure out the dimensions that the wedding cake in Figure 2 would have. Figure 1 Figure 2 The first cake has three layers with each one having a different top view. the bottom is a square, the middle is a hexagon, and the top is a circle. The height of each layer may vary. The second cake has three layers with a top view of concentric circles. All three layers have the same height. The diameter of the middle layer is 20% larger than the top layer, and the diameter of the bottom layer is 25% larger than the middle layer. Cake decoration (flowers, engraving, etc.) doesn't count in our calculations for this assignment. Procedure Create your python file, following the instructions from the assignment basics file. Perform the following actions in your code, in exact order storing their answers as needed in variables. 1. Greet the user with the message, "Welcome to CS112" 2. Ask the user: "What is your name? 3. Ask the user: "What is the length (inches) of the side of cake1 square layer?" 4. Ask the user: "What is the height (inches) of cake1 square layer?" 5. Ask the user: "What is the length (inches) of the side of cake1 hexagon layer?" 6. Ask the user: "What is the height (inches) of cake1 hexagon layer?" 7. Ask the user: "What is the diameter (inches) of cake1 circular layer?" 8. Ask the user: "What is the height (inches) of cake1 circular layer?" 9. Ask the user: "What is the diameter (inches) of cake2 bottom layer?" You need this because the height of cake2 depends on this parameter (you'll see when you do the math). 10. In order to calculate the amount of icing we need, compute the total surface area of cake1 (every surface that we must put icing on, including all sides of the layers). Display the result to the user in both square inches and square meters. 11. In order to calculate the amount of ingredients we need, compute the volume of cake1, and display it to the user in both cubic inches and cubic meters. 12. Compute and display to the user the ratio of the volume of each layer to the volume of cake1. 13. Compute and display to the user the height of cake2 in both inches and meters. 14. Compute and display to the user the total surface area of cake2 in both square inches and square meters. 15. Compute and display to the user the volume of cake2 in both cubic inches and cubic meters. If you got this correctly, the result should be the same as in #11 above. 16. Tell the user to enjoy their cake! Assumptions In computer science exact formatting of input/output is like putting on socks with shoes, while people might not do it 100% of the time in their personal life, it is extremely unusual not to do it in a professional setting. Therefore, you will need to format your input/output exactly like the sample provided. As we are just starting to program, and don't even have if-else statements at our disposal, we will assume many things to make the assignment easier, though it makes it slightly more artificial You may assume the following: There is no need to validate user's input. The user will always enter an integer when we ask for some number and a string when we ask for some text. The middle layer will always be enclosed by the bottom layer and the top layer will always be enclosed by the middle one. 1 inch equals 2.54 centimeters F is equal to 3.14159 Numbers should be rounded to four decimals when numeric results are displayed (not during computations). Restrictions Allowed things: Any arithmetic operators are all fine to use, such as +,-./,%, and, or, >,Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started