Create a simple java program that reads all the content in a .txt file, the user will enter the filename to be opened. In this case, the file will contain multiple lines of Car details with each line containing a single car detail. Your task is to then create a Car class that models the Make, Colour, type and year manufactured. The Car class should further be able to assign every car created with a unique serial number using a class variable[format is AAAYYYYCXX, AAA is the first 3 letters of the make, YYYY is the year it was manufactured, C is the first letter of the colour and XX is the value provided by the class variable(in form 01) all in upper caps see samples]. Within the driver class add all the cars read from the file onto a stack following LIFO approach and then print details of 2 cars from the stack that are older then 5 years. You are additionally expected to deal with most common exceptions(See samples below) [HINT: DO NOT PROVIDE A PATH BUT RATHER ONLY OPEN THE FILE WITH RELATIVE PATH/FILENAME] Sample run 1: Enter filename: input.txt sample output 1: 2 Cars from the stack: Car Make: Ford Colour: Blue Year Manufactured: 2016 Car Type: Sedan Serial No.: FOR2016B02 Car Make: Toyota Colour: White Year Manufactured: 2001 Car Type: SUV Serial No.: TOY2001W01   NB: input.txt contains "Toyota White SUV  2001" and "Ford Blue Sedan 2016" as the data in different lines [See sample file] Sample run 2: Enter filename: OldCars.txt sample output 2: Invalid file : OldCars.txt could not be found in the current directory NB: OldCars.txt is not a valid file Requested files InClass02.java input.txt   1 2     Toyota White SUV 2001 Ford Blue Sedan 2016         Car.java

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Create a simple java program that reads all the content in a .txt file, the user will enter the filename to be opened. In this case, the file will contain multiple lines of Car details with each line containing a single car detail. Your task is to then create a Car class that models the Make, Colour, type and year manufactured. The Car class should further be able to assign every car created with a unique serial number using a class variable[format is AAAYYYYCXX, AAA is the first 3 letters of the make, YYYY is the year it was manufactured, C is the first letter of the colour and XX is the value provided by the class variable(in form 01) all in upper caps see samples]. Within the driver class add all the cars read from the file onto a stack following LIFO approach and then print details of 2 cars from the stack that are older then 5 years. You are additionally expected to deal with most common exceptions(See samples below)

[HINT: DO NOT PROVIDE A PATH BUT RATHER ONLY OPEN THE FILE WITH RELATIVE PATH/FILENAME]

Sample run 1:

Enter filename: input.txt

sample output 1:

2 Cars from the stack:

Car Make: Ford
Colour: Blue
Year Manufactured: 2016
Car Type: Sedan
Serial No.: FOR2016B02

Car Make: Toyota
Colour: White
Year Manufactured: 2001
Car Type: SUV
Serial No.: TOY2001W01

 

NB: input.txt contains "Toyota White SUV  2001" and "Ford Blue Sedan 2016" as the data in different lines [See sample file]

Sample run 2:

Enter filename: OldCars.txt

sample output 2:

Invalid file : OldCars.txt could not be found in the current directory

NB: OldCars.txt is not a valid file

Requested files

InClass02.java

input.txt

 
1
2
 
 
Toyota White SUV 2001
Ford Blue Sedan 2016
 
 
 
 

Car.java

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY