INTRO JAVA 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 (a) reads input file and displays the total amount for each service category. (b) writes a separate file for each service category, containing the entries for that category ; the file name should be ; so if the input has Dinner and Conference as service categories, the output file will be Dinner.txt and Conference.txt Note: Display an error if the file does not exist or the format is incorrect. Create your own input file using the format described above, here are few lines from the input file: John Doe; Dinner; 45.69;04/19/2020 Sean Kim; Conference; 1000.00; 05/03/2021 Mike Jones;Conference;750.00;05/01/2021 Jane Smith;Dinner;50.00;04/19/2021   The program should generate the following outputs (if the input file contains the lines from above) 1. Display total amount per category Dinner: 95.69 Conference: 1750.00 2. File for each service category Dinner.txt John Doe; Dinner; 45.69;04/19/2020 Jane Smith;Dinner;50.00;04/19/2021 Conference.txt Sean Kim; Conference; 1000.00; 05/03/2021 Mike Jones;Conference;750.00;05/01/2021   Note: Don't hardcode service categories i.e. the program should support dynamic number of categories.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 

INTRO JAVA

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

(a) reads input file and displays the total amount for each service category.

(b) writes a separate file for each service category, containing the entries for that category ; the file name should be <ServiceCategory.txt> ; so if the input has Dinner and Conference as service categories, the output file will be Dinner.txt and Conference.txt

Note: Display an error if the file does not exist or the format is incorrect.

Create your own input file using the format described above, here are few lines from the input file:

John Doe; Dinner; 45.69;04/19/2020

Sean Kim; Conference; 1000.00; 05/03/2021

Mike Jones;Conference;750.00;05/01/2021

Jane Smith;Dinner;50.00;04/19/2021

 

The program should generate the following outputs (if the input file contains the lines from above)

1. Display total amount per category

Dinner: 95.69

Conference: 1750.00

2. File for each service category

Dinner.txt

John Doe; Dinner; 45.69;04/19/2020

Jane Smith;Dinner;50.00;04/19/2021

Conference.txt

Sean Kim; Conference; 1000.00; 05/03/2021

Mike Jones;Conference;750.00;05/01/2021

 

Note: Don't hardcode service categories i.e. the program should support dynamic number of categories.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Graphical User Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education