Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Intelligent Image Databases Towards Advanced Image Retrieval

Authors: Yihong Gong

1st Edition

1461375037, 978-1461375036

More Books

Students also viewed these Databases questions

Question

Identify the different methods employed in the selection process.

Answered: 1 week ago

Question

Demonstrate the difference between ability and personality tests.

Answered: 1 week ago