Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem You are asked to design a program in Java that would read 2 files (Cars.txt and DetailedReport.txt). The Cars.txt file contains a car type

Problem

You are asked to design a program in Java that would read 2 files (Cars.txt and DetailedReport.txt). The Cars.txt file contains a car type and some coded information about the issues associated with that car on each line. The DetailedReport.txt contains a string of text that explains the details associated with the numerical code.

Requirements

Write a Java program that will read and store the code and associated text. Then construct a way to read and output the information for each car. You will have to use normal exception handling for reading the file, things like missing files for example. You also have to handle specific problems within the file associated with processing the data it contains. In this case, you will need to handle the exceptional situation where a line from the file is incorrectly formed. You should create your own exception class. You should throw the exception for an incorrect line, catch the exception, print a warning message and continue to process the lines. You will also need to handle the exceptional circumstance of having a code that is not defined in the DetailedReport.txt file. You may manage this condition as you like, but you should print out an Unknown condition. Tips: When you read Cars.txt, be careful how you handle the numbers of errors for each car. Since each car have a different amount of errors, separated by spaces, you will need to parse the string. If you just use a loop to read, it might crash your program.

----------------------------------------------------------------------------------------------------------------------------------------------------

DetailReport.txt

0 Car Fixed 1 Brake 2 Wind Shield 3 Tires 4 Engine 5 Doors 

---------------------------------------------------------------------------------------------------------------------------------------------------

Cars.txt

Challenger 3 4 5 Camry 1 4 Civic 0 Siena 2 5 Corvette 0 Mustang 3 5 Fusion 1 2 5 Smart 1 2 Vanquish 9 

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_2

Step: 3

blur-text-image_3

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

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

b. Does senior management trust the team?

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago