Question: language: python Vending Machine: Create a vending machine program that meets the following specifications. The vending machine will only accept quarters, and all prices are
language: python
Vending Machine: Create a vending machine program that meets the following specifications. The vending machine will only accept quarters, and all prices are represented as the number of quarters needed to buy an item.
1. Create a function called displayChoices. This function will display the following vending machine menu with each item and its price as the number of quarters:
1: Candy bar 3 quarters
2: Chips 5 quarters
3: Soda 4 quarters
4: Gummy worms 2 quarters
2. Create a function called makeSelection. This function will take in as a parameter the number of quarters the user has. The program will then ask the user to type in the number of the item they wish to buy from the menu (1 for candy bar, 2 for chips, 3 for soda, 4 for gummy worms). The function will then determine if the user has enough quarters to purchase the item. If the user has enough quarters, it will print a message that the item is being vended and it will subtract the cost of the item from the users quarters (i.e. If I have 10 quarters and buy the chips, I will have 5 quarters remaining to spend.). If the user does not have enough money, it will print a message telling the user they do not have enough money for the item. The function will return the number of quarters the user has after the purchase.
An example of what running this functions output should look like is provided below. In t
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
