Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3 : The output should look like the images posted below. Drink Machine Simulator Write a program that simulates and manages a soft drink

Python 3 : The output should look like the images posted below. image text in transcribed
image text in transcribed
image text in transcribed
Drink Machine Simulator Write a program that simulates and manages a soft drink machine. Information on each drink type should be stored in a text file named machinelnfo.txt that has the following data for drink name, the drink price, and the number of drinks of that type currently in the machine. Liquid Name Price Quantity in Machine Cola 1.00 15 si Soda 1.00 15 e. Soda 1.00 15 Dr.Pepper Soda 1.00 15 Bottled Water 1.50 15 the content of the file and add them accordingly to the following three lists liquidNamel price, and quantityD Functions: displayMenu0 which displays a menu of drink names and prices purchaseDrink0 which handles a sale inputMoney0, which is called by purchaseDrink0 to accept, validate, and return (to purchaseDrink) the amount of money input dailyReporto, which is called at the end of the program to report how many of each drink type remain in the machine at the end of the day and how much money was collected The program should loop and call the displayMenu function and allows the patron to either pick a drink or quit the program. If the patron selects a drink, the purchaseDrink) function is called to handle the actual sale. This function should be passed the patron's drink choice. Here is what the purchaseDrink0) function should do Call the inputMoney() function, passing it the patron's drink choice. If the patron no longer wishes to make the purchase, return all input money If the machine is out of the requested soda, display an appropriate "sold out message and return all input money machine has the soda and enough money was entered.complete the sale by updating the quantity on hand and money collected information, calculating any change due to be returned to the patron, and delivering the soda. This last action can be simulated by printing an appropriate There is your beverage message. Input Validation: Your program should only accept valid menu choices Do not deliver a beverage if the money inserted is less than the price of the selected drink. machinelnfo.txt should be updated with the last sales and report accordingly Machine Beverage 1) Cola 2) Root Beer ) Orange Soda 4) Grape Soda 5) Bottled Water 6) Exit 1.00 1.00 1.00 1.00 1.50 lease insert sufficient soney for your beverage choice 0 if you no longer wish to purchase a drink money now:-39 Insufficient money was inserted. lease retrieve your money from the coin return slot. n insert enoughmoney for your chosen beverage Enter o if you no longer wish to purchase a drink r money now: 3 turned change 2.00 thump, splat! Enjoy your beverage! ac hine Beverage Choices 1) Cola 2) Root Beer 3) Orange Soda 4) Grape Soda 5) Bottled Water 6) Exit 1.00 1.00 1.00 1.00 1.50 lease insert sufficient money for your beverage choice Enter o if you no longer wish to purchase a drink Enter money now: Machine Beverage Choices 1) Cola 2) Root Beer 3) Orange Soda S 1.00 $ 1.00 5) Bottled Water 1.50 6) Exit End of Day Report antities Remaining in the Machine 20 20 19 20 ottled Water 20 oot Beer range Soda ape Soda aily earnings: $1.00 ress any key to continue Machine Beverage Choices 1) Cola 2) Root Beer 3) Orange Soda 4) Grape Soda S) Bottled Water 6) Exit 1.00 1.00 1.00 1.00 1.50 lease insert sufficient money for your beverage choice r o if you no longer wish to purchase a drink money nows 20 turned change: 19.00 thump, thump, splat! your beverage Machine Beverage Choices 1) Cola 2) Root Beer 3) Orange Soda 4) Grape Soda 5) Bottled Water 1.00 1.00 1.00 1.00 1.50 6) Exit lease insert sufficient money for your beverage choice 0 if you no longer wish to purchase a drink oney now: 12 turned change: 11.00 thump, thump, splat! your beverag Machine Beverage Choices 1) Cola 2) Root Beer 3) Orange Soda 4) Grape Soda 5) Bottled Water 6) Exit 1.00 .00 1.00 1.00 1.50 End of Day Report antities Remaining in the Machin 19 19 Orange Soda 20 20 ottled Water 20 Root Beer Grape Soda aily earnings: $2.00 ress any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions