Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create an Object Oriented application used to manage and search for cars. 1. You

ID: 3767756 • Letter: C

Question

Create an Object Oriented application used to manage and search for cars.

1.     Your task is to create an Object Oriented application used to maintain a catalog of used cars. The catalog keeps track of each car's make, model, year, and sale price.

The program begins with an empty catalog. The user is prompted to enter one of three possible commands:

·         add - add a single car to the catalog

·         import - allows you to import a file of cars into the catalog (CSV file)

·         list - list all cars in the catalog

·         search by make, model, year or price

·         quit - quit the application

If an unknown command is entered, the user should be informed and asked to enter another command. If the add or list commands are entered, the operation for that command is carried out, then the user is prompted for another command. The application continues until the quit command is entered.

The add command

If the add command is entered, the user will then be prompted to enter the car's make, model, year, and sales price, one-by-one. The make (e.g. Isuzu) and model (e.g. Trooper) can be arbitrary strings, while the year (e.g. 1990) should be an integer and the sales price (e.g. 2599.99) should be a floating point value. After the data is entered, the record should be stored so it can be recalled later by the list command. You may assume that the catalog will never hold more than 25,000 cars.

OO REQUIREMENTS:

Must be Object Oriented with at least 1 class. (HINT: Car?)

Explanation / Answer

package Catalog;

import java.util.ArrayList;

import java.util.InputMismatchException;

import java.util.Scanner;

public class Car{

Public void Search()

{

System.out.println(“what are you going to enter: choose from 1:make, 2:model,3:year, 4:price”);

Choice=choiceInput.nextInt();

Switch(choice)

Case 1:

System.out.println(“please enter the make of car”);

smake = userInput.nextLine();

for (int i = 0; i < CarList.size(); i++)

{

if( smake= =CarList.make[i])

newStatus= Available;

System.out.pritnln(“the car is available”);

}

Break;

Case 2:

System.out.println(“please enter the model of car”);

smodel = userInput.nextLine();

for (int i = 0; i < CarList.size(); i++)

{

if( smodel= =CarList.model[i])

newStatus= Available;

System.out.pritnln(“the car is available”);

}

break;

Case 3:

System.out.println(“please enter the year of car”);

sYear = userInput.nextLine();

for (int i = 0; i < CarList.size(); i++)

{

if( sYear= =CarList.Year[i])

newStatus= Available;

System.out.pritnln(“the car is available”);

}

break;

Case 4:

System.out.println(“please enter the price of car”);

newsalesprice = userInput.nextLine();

for (int i = 0; i < CarList.size(); i++)

{

if( newsalesprice= =CarList.salesprice[i])

newStatus= Available;

System.out.pritnln(“the car is available”);

}

break;

default:

System.out.println(“you have entered a wrong choice”);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote