Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help fighting out this java program using NetBeans. CSC 212 Principles of Programming Homework Assignment 4 Write a Java program that reads in

image text in transcribed

image text in transcribed

I need help fighting out this java program using NetBeans.

CSC 212 Principles of Programming Homework Assignment 4 Write a Java program that reads in a file containing data about cars and builds a car database The input file can be found here (be sure to access this file using your Oswego-Google account, not your private one). Each line of file input should be used to create a Car object. Use an array of Car objects in a carDatabase class to access and print various information about the cars. Finally, your program should also use a command interpreter in the Main class that allows the user to issue commands and retrieve the data as shown in the example (see below) Design Make sure that your program uses a Java package called csc212hw04'. Your program should consist of the following classes Main . . Read input from the user to get size of the array, input file name, and commands. Process commands as shown in the example CarDatabase This should contain a private array of car objects Write a constructor that accepts an integer to set the size of the array Write the following public methods o isFul1 returns a boolean value indicating if array is full o readFile accepts a string parameter (the file name) and uses a Scanner to read in all the lines, create Car objects, and put them in the array o displayMake accepts a string parameter and prints all cars with that make o mpgRange accepts two double parameters and prints all the cars whose mpg falls in that range o weightRange like mpg, but for weight o displayAL1 ) -display all the cars in the database Car . Should have the following public variables o String model o String make o double mpg o int weight o int year A constructor method that accepts parameters to initialize all the variables . A tostring) method that returns all the variables with a label (as shown in the example) CSC 212 Principles of Programming Homework Assignment 4 Write a Java program that reads in a file containing data about cars and builds a car database The input file can be found here (be sure to access this file using your Oswego-Google account, not your private one). Each line of file input should be used to create a Car object. Use an array of Car objects in a carDatabase class to access and print various information about the cars. Finally, your program should also use a command interpreter in the Main class that allows the user to issue commands and retrieve the data as shown in the example (see below) Design Make sure that your program uses a Java package called csc212hw04'. Your program should consist of the following classes Main . . Read input from the user to get size of the array, input file name, and commands. Process commands as shown in the example CarDatabase This should contain a private array of car objects Write a constructor that accepts an integer to set the size of the array Write the following public methods o isFul1 returns a boolean value indicating if array is full o readFile accepts a string parameter (the file name) and uses a Scanner to read in all the lines, create Car objects, and put them in the array o displayMake accepts a string parameter and prints all cars with that make o mpgRange accepts two double parameters and prints all the cars whose mpg falls in that range o weightRange like mpg, but for weight o displayAL1 ) -display all the cars in the database Car . Should have the following public variables o String model o String make o double mpg o int weight o int year A constructor method that accepts parameters to initialize all the variables . A tostring) method that returns all the variables with a label (as shown in the example)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions