2023 The Car Class Define a class called Car that implements the parameterized Comparable interface | Assignment Collections

Computer Science 2023 Define A Class Called Car That Implements The Parameterized Comparable Interface

2023 The Car Class Define a class called Car that implements the parameterized Comparable interface | Assignment Collections

The Car Class
Define a class called “Car” that implements the parameterized Comparable interface. Each object of this class represents a type of car. Your class must provide all the methods in the public interface. Be sure to properly document each method in this class.
The CarComparator Class
Define a class, “CarComparator”, that implements the parameterized Comparator interface. The Compare method should compare cars by -year+make+model, where + denotes ascending order, – denotes descending order, and year, make and model are the primary, secondary and tertiary keys.
The CarSorter Class
Write a program, CarSorter, to test your Car and
CarComparator implementations. Suppose that you have a text file with each line containing the year, an integer, the make, a one-word string, and model, a string of one or more words, of a car. Write a program that reads the information about the cars from the file and stores them in an array list of objects of the Car class.
For example, the input file to the program could be carlot.txt whose contents are shown below:
1998 Honda Prelude
1998 Honda Accord
2006 Honda Ridgeline
1996 Ford Taurus
1996 Mitsubishi Eclipse
2015 Mitsubishi Galant
2010 Ford Fusion
2003 Mazda Protege 5
2002 Mazda Protege 5
2002 Isuzu Trooper
Your program should do the following:
1. prompt the user for the name of the input file,
2. read the data from the input file and store information about the cars in an array list of Car objects,
3. print the unsorted data from the array list to the screen, as shown below,
4. create another array list and an array that contain the same data as the original array list,
5. sort the second array list by the order defined by the Comparable interface, while leaving the original array list unsorted
6. prompt the user for the name of an output file and then display on the screen and write the information in the sorted array list to the file,
7. sort the array by the order defined by the Comparable interface,
8. prompt the user for the name of a second output file and then display on the screen and write the information in the sorted array to the file,
9. again, create a third array list and a second array that contain the same data as the original array list,
10. sort the third array list using a comparator of the CarComparator class,
11. prompt the user for the name of third output file and then display on the screen and write the information in the sorted array list to the file,
12. sort the second array using a comparator of the CarComparator class,
13. and, finally, prompt the user for the name of a fourth output file and then display on the screen and write the information in the sorted array to the file.
The input file may contain information about any number of cars. The output to the file and on the screen should be formatted as shown in the sample run below. Your program should use a try-catch statement to handle any potential IOException.
Enter the name of the input file -> carlot.txt
The Unsorted Array List of Cars
[Honda, Prelude, 1998]
[Honda, Accord, 1998]
[Honda, Ridgeline, 2006]
[Ford, Taurus, 1996]
[Mitsubishi, Eclipse, 1996]
[Mitsubishi, Galant, 2015]
[Ford, Fusion, 2010]
[Mazda, Protege 5, 2003]
[Mazda, Protege 5, 2002]
[Isuzu, Trooper, 2002]
Enter the name of the first output file -> mmya1.txt
The Sorted Array List of Cars By Make-Model-Year
————————————————
Ford Fusion 2010
Ford Taurus 1996
Honda Accord 1998
Honda Prelude 1998
Honda Ridgeline 2006
Isuzu Trooper 2002
Mazda Protege 5 2002
Mazda Protege 5 2003
Mitsubishi Eclipse 1996
Mitsubishi Galant 2015
Enter the name of the second output file -> mmya.txt
The Sorted Array of Cars By Make-Model-Year
——————————————-
Ford Fusion 2010
Ford Taurus 1996
Honda Accord 1998
Honda Prelude 1998
Honda Ridgeline 2006
Isuzu Trooper 2002
Mazda Protege 5 2002
Mazda Protege 5 2003
Mitsubishi Eclipse 1996
Mitsubishi Galant 2015
Enter the name of the third output file -> ymmal.txt
The Sorted Array List of Cars By Year-Make-Model
————————————————
2015 Mitsubishi Galant
2010 Ford Fusion
2006 Honda Ridgeline
2003 Mazda Protege 5
2002 Isuzu Trooper
2002 Mazda Protege 5
1998 Honda Accord
1998 Honda Prelude
1996 Ford Taurus
1996 Mitsubishi Eclipse
Enter the name of the fourth output file -> ymma.txt
The Sorted Array of Cars By Year-Make-Model
——————————————-
2015 Mitsubishi Galant
2010 Ford Fusion
2006 Honda Ridgeline
2003 Mazda Protege 5
2002 Isuzu Trooper
2002 Mazda Protege 5
1998 Honda Accord
1998 Honda Prelude
1996 Ford Taurus
1996 Mitsubishi Eclipse

 

 

 

We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.

Place Order Now

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational