Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions