Write in Python on Visual Code, the money collection interface for the coffee vending machine. Your program should tell the user the price of the item and then the user will enter the amount of money that they are paying (this simulates them actually inserting cash). If the money collected is less than the price, print an appropriate message (such as: “Insufficient funds, no sale!”) and then the program should exit. If enough money is collected, determine the amount to return to the customer. If the change due is not zero, tell the user how much change they will receive. Next print a message (such as “Thank you – enjoy your coffee !”) and end the program normally. Note, your program should be able to handle all amounts of money (not just multiples of dollars but also cents such as $1.25). Also you may assume that the user is only entering a number and not the $ (though the $ could be part of your prompt).Hint: Check how to do floating point comparisons!

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question

Write in Python on Visual Code, the money collection interface for the coffee vending machine. Your program should tell the user the price of the item and then the user will enter the amount of money that they are paying (this simulates them actually inserting cash). If the money collected is less than the price, print an appropriate message (such as: “Insufficient funds, no sale!”) and then the program should exit.

If enough money is collected, determine the amount to return to the customer. If the change due is not zero, tell the user how much change they will receive. Next print a message (such as “Thank you – enjoy your coffee !”) and end the program normally.

Note, your program should be able to handle all amounts of money (not just multiples of dollars but also cents such as $1.25). Also you may assume that the user is only entering a number and not the $ (though the $ could be part of your prompt).Hint: Check how to do floating point comparisons!

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning