Question: /** * Lab-02_FileIO-OOP * @author (put your name here) * */ // =================================== // Instructions: // 1. Create a Car class and match // up

 /** * Lab-02_FileIO-OOP * @author (put your name here) * */

/** * Lab-02_FileIO-OOP * @author (put your name here) * */ // =================================== // Instructions: // 1. Create a Car class and match // up the fields with the fields // from the text file. // 2. Code an importer and save // Car records in an ArrayList // 3. Follow the instructions below // for the code to build // // ** For your Car class include: // Section breaks // Constructors // Workhorse // String // String array // copy // clone() // equals() // toString() // Getters // Setters // // =================================== public class Tester { // Create an ArrayList objects here public static void main(String[] args) { loadData("cars.txt"); printCars(); printCarsByMake("Honda"); printCarsByPriceRange(20400, 21300); } private static void loadData(String string) { // Use a try-catch and read in all cars and populate your ArrayList list try(){ } catch (Exception e) { } } private static void printCars() { // Prints all cars in the following format: // year make model price // Example output: // // All Cars

// ======================================== // 2001 Honda Accord $24,200 // 1980 Pontiac Grand Prix $ 500 // 1995 Civic $12,150 // ... } private static void printCarsByMake(String make) { // Prints all cars by the given make // Example output: // // Honda // =========================== // 2001 Accord $24,200 // 1995 Civic $12,150 // ... } private static void printCarsByPriceRange(int lo, int hi) { // Prints all cars that costs from lo to hi // Example output: // // Cars costing $20,400 to $21,300 // ======================================== // Cost Year Car // ------- ---- -------------------------- // $24,200 2001 Honda Accord // $ 500 1980 Pontiac Grand Prix // ... }

}

1. Go to Mockaroo.com and create and download a file (name it: cars.txt) that represents a car. o Mockaroo has the following fields you are to add: vin make model . car model year cost (number: select this and put a range from 500 to 50000) color (use the word version - e.g., Red, Blue, etc.) Change the Format to: Tab-Delimited o Change the Line Ending to: Windows(CRLF) o The Mockaroo screen should look like the below image. Field Name Type Options vin D Car VIN blank: 0 % make Car Make blank: 0% 0 model Car Model blank: 0 % year Car Model Year blank: 0 % cost Number min: 500 max: 50000 decimals: o blank: 0% color Color blank: % 0 % X ADD ANOTHER FIELD # : # Rows: 1000 Format: Tab-Delimited - Line Ending: Windows (CRLF) - ) - Include: header O BOM BOM 2. After downloading the file you are to create a java program that reads in all the records and processes the data. You are supplied with the starter Tester.java code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!