Question: Part 2: Time for a Change Suppose you are given a list of coins in your cash register. You have a customer come to your
Part 2: Time for a Change Suppose you are given a list of coins in your cash register. You have a customer come to your register with $1.00 and a purchase worth 1.00 or less. You need to look in your cash register for the correct change and provide it to your customer Write a program to first ask for the name of a file containing the contents of your register and read from that file the list of all coins you have Report the contents and then, ask the user for the cost of the item they are purchasing. As- sume they are paying with $1.00 and calculate the change they should receive using the coins in your register. Use larger values first, beginning with $0.50 and continuing through $0.25, $0.10, $0.05, and finally $0.01. At the end, either report the correct change, or print a message saying that you cannot give correct change and print out what you need to satisfy the request Let's assume you have the following coins available to you in coins.txt 50, 6 25, 2 10, 1 5, 1 1, 2 Here are some sample outputs of your program: Enter the coin file name >coins.txt coins. txt Enter the item cost in cents (0-100) 80 80 I have the following coins: [50, 50, 50, 50, 50, 50, 25, 25, 10, 5, 1, 1) Change from $1.00 is 20 cents I cannot make change with my current coins I need an additional 3 centsS
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
