Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started