Question
In Python please 1- Prompt user What would you like? (small/ medium/ large/ off/ report) small, medium, large: Check the resources and decide what to
In Python please
1- Prompt user "What would you like? (small/ medium/ large/ off/ report)" small, medium, large: Check the resources and decide what to do next. off: Turn off the machine, report: A report should be generated that shows the current resource values. After the sandwich is dispensed, the prompt should display again to serve the next customer once the order has been completed. 2- Check that the resources are sufficient. Program should check whether there are enough resources to make the sandwich when the user chooses it. For example, if a small size ham sandwich requires 4 slices of bread but there are only 2 slices left, the machine should stop the process and return the following message: Sorry there is not enough bread. Resources is a dictionary with these initial values: resources = { "bread": 12, ## slice "ham": 18, ## slice "cheese": 24 ## ounces } 3- Process the inserted coins: The machine accepts large dollar ($1), half dollar ($0.5), quarter ($0.25) and nickel ($0.05) coins. If there are sufficient resources to make the drink selected, then the program should prompt the user to insert coins. Using the coins inserted, calculate their monetary value. 4- Has the transaction been successful? Make sure the user has inserted enough money to purchase the sandwich they have selected. IF there is not enough money, machine returns Sorry, thats not enough money. Money refunded. The machine should offer change if the user has inserted too much money by returning the following message: Here is $x in change 5- Make sandwich: The ingredients for the sandwich should be deducted from machine resources if the transaction is successful.
Once all resources have been deducted, returns the following message: sandwich is ready. Bon appetit!. (You should include the size of ordered sandwich in this message) Here are recipes for three types of ham sandwiches: recipes = { "small": { "ingredients": { "bread": 2, ## slice "ham": 4, ## slice "cheese": 4, ## ounces }, "cost": 1.75, }, "medium": { "ingredients": { "bread": 4, ## slice "ham": 6, ## slice "cheese": 8, ## ounces }, "cost": 3.25, }, "large": { "ingredients": { "bread": 6, ## slice "ham": 8, ## slice "cheese": 12, ## ounces }, "cost": 5.5, } } 6- Show report: Resources should be listed along with their current values in the report. It is therefore necessary for the report to show the values that have been deducted after making a sandwich.
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