Question: Write a program that reads a text file, as described in Exercise P7.8, and writes a separate file for each service category. Each service category

Write a program that reads a text file, as described in Exercise P7.8, and writes a separate file for each service category. Each service category file should contain the entries for that category. Name the output files Dinner.txt, Conference.txt, and so on.


Data from Exercise P7.8,

A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: The name of the client, the service sold (such as Dinner, Conference, Lodging, and so on), the amount of the sale, and the date of that event. Write a program that reads such a file and displays the total amount for each service category. Display an error if the file does not exist or the format is incorrect.

Step by Step Solution

3.43 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is an example of how you could approach this problem in Python def readsalesfilefilename Initia... View full answer

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 Java Concepts Late Objects Questions!