Question: A cash register keeps three log files: customers.txt , payments.txt and taxes.txt . Together, the files compose the transactions run on the register. Write some

A cash register keeps three log files: customers.txt, payments.txt and taxes.txt. Together, the files compose the transactions run on the register.
Write some code that reads the files line by line and displays for each , $,%. Make sure to display when there is bad data in any of the files with a ?, and to display a message if any of the files are missing.
In the case of customers.txt, if the line is empty display ?; in the case of payments.txt, if the line is not a number or is empty display ?; in the case of taxes.txt, if the line is not a number, is a number but not between 0 and 1 or is empty display ?.
Sample Run (everything ok)
James Stirling, $21.99,24%
Mark Lucas, $102.47,11%
Sherley Moss, $1.99,24%
Sample Run (bad data)
James Stirling, $21.99,24%
Mark Lucas, $?,11%
Sherley Moss, $1.99,?%
?, $0.99,?%
Sample Run (missing file)
Could not open register files.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!