Question: How do i make a list that sorts them by make model and year while giving them appropriate space? Current code i have: import java.io
How do i make a list that sorts them by make model and year while giving them appropriate space?
Current code i have:
import java.ioBufferedReader;
import java.ioFileReader;
import java.ioIOException;
public class DisplayCars
public static void mainString args
String filename "cars.txt;
try
BufferedReader reader new BufferedReadernew FileReaderfilename;
String line;
Skip the header line
reader.readLine;
while line reader.readLine null
Split the line by tab character
String carProperties line.splitt;
Check if the array has at least three elements
if carPropertieslength
Extracting car properties
String make carProperties;
String model carProperties;
String year carProperties;
Displaying the formatted output
System.out.printfsssn make, model, year;
else
System.out.println
: line;
reader.close;
catch IOException e
eprintStackTrace;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
