​​​​​​​LANGUAGE IS JAVA Part One A hotel salesperson enters sales in a text file. Each line contains the...

70.2K

Verified Solution

Question

Programming

​​​​​​​LANGUAGE IS JAVA

  • Part One

  • A hotel salesperson enters sales in a text file. Each linecontains the following, separated by semicolons:
    • The name of the client,
    • the service sold (such as Dinner, Conference, Lodging, and soon),
    • the amount of the sale,
    • and the date of that event.
  • Prompt the user for data to write the file.

    Part Two

  • Write a program that reads the text file as described above,and that writes a separate file for each service category,containing the entries for that category. Name the output filesDinner.txt, Conference.txt, and so on.
  • Enter the name of the output file from Part One as a commandline argument.

    Both Parts

  • For all programs, catch and handle the Exceptions appropriatelyand validate the input data where needed.
  • Display an error if the sales file does not exist or the formatis incorrect.
  • Also, create your own exception to handle \"unknown transaction\"exceptions.

    Samples:

    • Contents of sales.txt (file created in part one)
      John Public;Dinner;29.95;6/7/2014Jane Public;Conference;499.00;8/9/2014Abby Lawrence;Dinner;23.45;10/10/2014
    • Contents of Dinner.txt (file created in part two)
      John Public;Dinner;29.95;6/7/2014Abby Lawrence;Dinner;23.45;10/10/2014
    • Contents of Conference.txt (file created in part two)
      Jane Public;Conference;499.0;8/9/2014

Grading Criteria

  • You will be graded on the following components:
  • Does the program do what is required
  • Is it properly documented
  • Is it fully tested
  • As always, remember to create a default constructor andoverride the toString() method for all classes.
  • Is it properly designed

Answer & Explanation Solved by verified expert
4.2 Ratings (709 Votes)
CODE Please implement the validations as per the requirement Thisprogram will enter data in a file and segregate the files based onthe servicesimport javaioimport javautilHashMapimport javautilIteratorimport javautilMapimport javautilScannerpublic class SalesPerson public static void mainString args HashMap String String services new HashMap String String try FileWriter input new    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students