We are going to use our programming skills to compute the number of slices you can...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
We are going to use our programming skills to compute the number of slices you can cut out of a cake of certain dimensions. Create your python file, following the instructions from the project 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 the Cake Slice Program! 2. Ask the user: "What kind of cake did you make? " 3. Ask the user: "How long is the cake in centimeters? " 4. Ask the user: "How wide is the cake in centimeters? " 5. Ask the user: "How long will you cut your slices in centimeters? " 6. Ask the user: "How wide will you cut your slices in centimeters? " 7. Compute the surface area of the cake, and display it to the user 8. Compute the number of pieces of cake that can be cut, and display it to the user. a. You should also determine the amount of cake area that the cake slices will consume, and display that as a percentage. 9. Compute the amount of cake that wasted by cutting it into slices, and display that to the user. a. You should also determine this number as a percentage of the total area of the cake, and display that to the user. 10. Compute the number of edge and center pieces in the cake, and display that to the user. a. Below, we assume that there will always be four edges of the sliced cake. Be sure that you don't double count the corner pieces! b. Ignore the wasted cake, and calculate edges/centers out of the rectangle of actual cake slices. 11. 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 samples 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 project easier, though it makes the project slightly more artificial. You may assume the following: • The user will always enter an integer when we ask for an integer, etc. • Every number the user enters will be a positive number when testing this project. • The length of a slice will be less than half the length of the cake. • The width of a slice will be less than half the width of the cake. On "wasted cake:" For this project, assume that we start to cut the cake from one corner, and work our way down one side of the cake. When you reach the end of that side, you continue the same cutting process for the next row of cake. If you get to a point where there is a leftover amount of cake on any side (that is less than the size of the slice down that side) then you just throw away that leftover bit. If there is a leftover amount of cake on both sides, then you have to throw away the opposite corner of cake too! The number that you are figuring out for "wasted" cake is the total amount of cake that gets thrown away because it cannot be cut into a slice via this edge throwaway method. Restrictions You can ask for additional functionality to be allowed, but the chances are slim that we will approve it. The general theme is, the interesting parts of the assignment must be completed by the student, not built-in functions. Allowed things: • Any arithmetic operators are all fine to use, such as +, -, *, /, %, and, or, >=, <, etc. • The following data types, and their casting functions: int, float, string, bool. No others. • This function: round () • Note: Not everything listed above is needed for the project. Disallowed things: • You may not import other modules (like math) or write your own functions. • No data types omitted from the "Allowed things" section above may be used. • No branching (if statements), or loops (for/while). • If [insert thing here] is not specifically listed in "allowed things" chances are >95% that it's not allowed. 1 We are going to use our programming skills to compute the number of slices you can cut out of a cake of certain dimensions. Create your python file, following the instructions from the project 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 the Cake Slice Program! 2. Ask the user: "What kind of cake did you make? " 3. Ask the user: "How long is the cake in centimeters? " 4. Ask the user: "How wide is the cake in centimeters? " 5. Ask the user: "How long will you cut your slices in centimeters? " 6. Ask the user: "How wide will you cut your slices in centimeters? " 7. Compute the surface area of the cake, and display it to the user 8. Compute the number of pieces of cake that can be cut, and display it to the user. a. You should also determine the amount of cake area that the cake slices will consume, and display that as a percentage. 9. Compute the amount of cake that wasted by cutting it into slices, and display that to the user. a. You should also determine this number as a percentage of the total area of the cake, and display that to the user. 10. Compute the number of edge and center pieces in the cake, and display that to the user. a. Below, we assume that there will always be four edges of the sliced cake. Be sure that you don't double count the corner pieces! b. Ignore the wasted cake, and calculate edges/centers out of the rectangle of actual cake slices. 11. 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 samples 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 project easier, though it makes the project slightly more artificial. You may assume the following: • The user will always enter an integer when we ask for an integer, etc. • Every number the user enters will be a positive number when testing this project. • The length of a slice will be less than half the length of the cake. • The width of a slice will be less than half the width of the cake. On "wasted cake:" For this project, assume that we start to cut the cake from one corner, and work our way down one side of the cake. When you reach the end of that side, you continue the same cutting process for the next row of cake. If you get to a point where there is a leftover amount of cake on any side (that is less than the size of the slice down that side) then you just throw away that leftover bit. If there is a leftover amount of cake on both sides, then you have to throw away the opposite corner of cake too! The number that you are figuring out for "wasted" cake is the total amount of cake that gets thrown away because it cannot be cut into a slice via this edge throwaway method. Restrictions You can ask for additional functionality to be allowed, but the chances are slim that we will approve it. The general theme is, the interesting parts of the assignment must be completed by the student, not built-in functions. Allowed things: • Any arithmetic operators are all fine to use, such as +, -, *, /, %, and, or, >=, <, etc. • The following data types, and their casting functions: int, float, string, bool. No others. • This function: round () • Note: Not everything listed above is needed for the project. Disallowed things: • You may not import other modules (like math) or write your own functions. • No data types omitted from the "Allowed things" section above may be used. • No branching (if statements), or loops (for/while). • If [insert thing here] is not specifically listed in "allowed things" chances are >95% that it's not allowed. 1
Expert Answer:
Answer rating: 100% (QA)
Program welcome message printWelcome to the Cake Slice Program inputs type inputWhat kind of cake di... View the full answer
Related Book For
Principles of managerial finance
ISBN: 978-0132479547
12th edition
Authors: Lawrence J Gitman, Chad J Zutter
Posted Date:
Students also viewed these programming questions
-
You have just been told, Because we are going to finance this project with debt, its required rate of return must exceed the cost of debt. Do you agree or disagree? Explain.
-
In this problem, we are going to use the money market to model two real world events: i) a portfolio shock to money demand and ii) a shock to the money multiplier. Suppose you have the following...
-
Compute the number of dollars that can be bought with two million of each foreign currency units: a. $1 = 20,864 Vietnamese dong b. $1 = 6.300 Venezuelan bolivar fuerte c. $1 = 9.175 South African...
-
DFI of real sequences with odd harmonics only Let x(n) be an N -point real sequence with N-point DFT X(k) (N even). In addition, x(n) satisfied the following symmetry property: x(n + N/2) = -x(n) n =...
-
To eliminate reflections of normally incident plane waves, a dielectric slab of thickness d and relative permittivity er2 is to be inserted between two semi-infinite media with relative...
-
A recent survey by the American Automobile Association showed that a family of two adults and two children on vacation in the United States will pay an average of $247 per day for food and lodging...
-
The Graduate Management Admission Test (GMAT) is a standardized exam used by many universities as part of the assessment for admission to graduate study in business. The average GMAT score is 547...
-
Assume that Banff Electronics completed these selected transactions during March 2012: a. Sales of $2,400,000 are subject to estimated warranty cost of 4%. The estimated warranty payable at the...
-
What is the role of technology in today's recruitment and selection processes? What are the practical implications of this decision for public employer? Should they impose residency requirements at...
-
1. Name at least three ways that Shu could automate her asset management. Suggest at least one option for retirement savings, general savings, and general convenience. 2. What major factors should...
-
Allans employer purchased a car in March 2020 at a cost of $44,000 GST inclusive and provided the car to Allan on 1 April 2020. Allan garages the car at his home each night during the 2020/21 FBT...
-
What are incentive plans? Describe the main types of incentives plans.
-
Describe the different financial ratios that can be calculated to assess whether a sports organizations financial objectives are being met.
-
Attend a womens sporting event and record the demographic profile of the spectators. What are your observations? Use these observations and suggest how you might segment, target, and position (market...
-
What do you understand by fixed overheads? Why are they called burdens?
-
Design a rewards system to encourage intrapreneurship.
-
26. Water flows over the bump as shown in the figure. If h1 = 1 m and h2 = 0.4 m what will the depth of water be above the crest of the bump? U h U2 h2 Figure Q26 If h1 = 1 m and h2 = 0.4 m what will...
-
You are the newly appointed tax practitioner to complete Emilys tax return and have downloaded the prefill report for Emilys tax return (hint, you can read what a prefill report is here (Links to an...
-
a. Determine the total annual cost of each of the three possible financing strategies. b. Assuming that the firm expects its current assets to total $4 million throughout the year determine the...
-
Calculate the value of each of the bonds shown in the following table, all of which pay interest annually.
-
What role does an investment banker play in a public offering? Explain the sequence of events in the issuing of stock.
-
Why should projects be linked to the organisation's Strategic Plan?
-
What is the BCG matrix and how is it used?
-
Reflect on how the 'pair-wise' criterion system could be applied in your organisation. Against which criterion would you carry out prioritisation?
Study smarter with the SolutionInn App