subject

Use BlueJ to write a program that reads a sequence of data for several car objects from an input file. It stores the data in an ArrayList list. Program should work for input file containing info for any number of cars. (You should not assume that it will always be seven lines in the input file). Use notepad to create input file "inData. txt". File should be stored in the same folder where all files from BlueJ for this program are located.

Class Car describes one car object and has variables vin, make, model all of String type, cost of type double, and year of int type. Variable vin is vehicle identification number and consist of digits and letters . In addition, class Car has methods:

public double getCost() // returns car’s cost

public String getMake() // returns car’s make

public boolean isExpensive() // returns true if car has cost above 30000 and false

//otherwise

public boolean isAntique() // returns true if car’s has above 50 years, and false

// otherwise

public String toString() // returns string with all car’s data in one line

// separated by tabs.

Design class CarList that has instance variable list of ArrayList type. Variable list is initialized in the constructor by reading data for each car from an input file. Each line of input file "inData. txt" has vin, make, model, cost, and year data in this order, and separated by a space. The data for the first five cars in the input file should be as follows:

1234567CS2 Subaru Impreza 27000 2017

1233219CS2 Toyota Camry 31000 2010

9876543CS2 Ford Mustang 51000 1968

3456789CS2 Toyota Tercel 20000 2004

4567890CS2 Crysler Royal 11000 1951

Add remaining two rows for the two additional cars of your choice.

Class CarList also has the following methods:

public void printList() // Prints title and list of all cars (each row prints one car)
public void printExpensiveCars() //Prints "List of expensive cars:" followed by
// list of expensive cars (one car per row)

public Car cheapestCar() // Method returns Car object with lowest cost.
public int countCarsWithModel(String model) // Method accept model and
// returns count of cars with given model.

//Method antiqueCarList is extra credit.

public ArrayList antiqueCarList () // Returns ArrayList of all antique
//cars from the list.

The last three methods just return the specified data type. Do not print anything within those methods. Just return result, and have explanation printed at the place where those methods are invoked.

Class TestCarList will have main method. In it, instantiate an object from CarList class and use it to invoke each of the five methods from CarList class.

Do not forget to append throws IOException to the constructor of CarList class and main method header in class TestCarList. In addition, you have to provide

import java. io.*;

import java. util.*;

in order to use Scanner and ArrayList classes from Java.

SUBMIT a single word or PDF document named p1yourLastNameCS152 with the following:

Your name, class section and project number and date of submission in the upper left corner
Copy of the code for each class in separate rectangle (table of size 1x1 with single cell)
Copy of your input file
Picture of program run from BlueJ.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
Dave has to create animations for a game. which tool can dave use?
Answers: 3
question
Computers and Technology, 22.06.2019 13:30
In which phase does software coding and testing happen in the spiral model? the spiral model does not have a separate testing phase. both, software coding and testing occurs during the phase.
Answers: 3
question
Computers and Technology, 23.06.2019 12:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
question
Computers and Technology, 24.06.2019 02:30
How to apply the fly in effect to objects on a slide
Answers: 1
You know the right answer?
Use BlueJ to write a program that reads a sequence of data for several car objects from an input fil...
Questions
question
Mathematics, 15.02.2021 17:50
question
Mathematics, 15.02.2021 17:50
Questions on the website: 13722363