Computers and Technology
Computers and Technology, 12.02.2020 05:59, ecbow9232

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.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 06:50, Mordred809
Type the correct answer in the box. spell all words correctly. which view of report creation allows you to customize the report before the database program creates it? creating a report in allows you to customize the report before the database program creates it. pl asap
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, vivian2020
Read this excerpt from helen keller’s autobiography, the story of my life. have you ever been at sea in a dense fog, when it seemed as if a tangible white darkness shut you in, and the great ship, tense and anxious, groped her way toward the shore with plummet and sounding-line, and you waited with beating heart for something to happen? i was like that ship before my education began, only i was without compass or sounding-line, and had no way of knowing how near the harbour was. "light! give me light! " was the wordless cry of my soul, and the light of love shone on me in that very hour. . the morning after my teacher came she led me into her room and gave me a doll. the little blind children at the perkins institution had sent it and laura bridgman had dressed it; but i did not know this until afterward. when i had played with it a little while, miss sullivan slowly spelled into my hand the word "d-o-l-l." i was at once interested in this finger play and tried to imitate it. when i finally succeeded in making the letters correctly i was flushed with childish pleasure and pride. running downstairs to my mother i held up my hand and made the letters for doll. i did not know that i was spelling a word or even that words existed; i was simply making my fingers go in monkey-like imitation. in the days that followed i learned to spell in this uncomprehending way a great many words, among them pin, hat, cup and a few verbs like sit, stand and walk. based on this excerpt, which words best describe helen keller?
Answers: 2
image
Computers and Technology, 23.06.2019 08:00, leleee10
Which argument is not a valid filter? does not equal this quarter filter by cell color all of these are valid filter arguments.
Answers: 2
image
Computers and Technology, 23.06.2019 10:00, karissanichole18
Install and use wireshark program ( send back screen shots and other vital information) case project 3-2: decode a tcp segment in a wireshark capture in this chapter, you walked through tcp segment to interpret the data included in its header. in this project, you use wireshark to capture your own http messafes, examine the tcp headers, and practice interpreting the data you'll find there. 1. open wireshark and snap the window to one side of your screen. open a browser and snap that window to the other side of your screen so you can see both windows.
Answers: 2
Do you know the correct answer?
Use BlueJ to write a program that reads a sequence of data for several car objects from an input fil...

Questions in other subjects:

Konu
English, 22.06.2019 08:30
Konu
Advanced Placement (AP), 22.06.2019 08:30
Konu
Mathematics, 22.06.2019 08:30