Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is what the program asks us to do. Here is an example of the output: Here is my code for the main class: Here

image text in transcribed

This is what the program asks us to do. Here is an example of the output:

image text in transcribed

Here is my code for the main class:

image text in transcribed

image text in transcribed

Here is my code for the CarDatabase class:

image text in transcribed

image text in transcribed

Here is my code for the Car class:

image text in transcribed

And here is my output:

image text in transcribed

I understand what it is doing wrong but I can't for the life of me figure out how to fix it, if someone could please give me a helping hand it would be much appreciated. Thank you.

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 to Expert-Tailored 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

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

ISBN: 1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

Explain how an open market purchase increases the money supply.

Answered: 1 week ago