Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Create a class Car name, model, color (String, int, String) Overloaded constructor toString Method Create second class Vehicle type, horse_power, array of Car class

image text in transcribed

Java

Create a class Car name, model, color (String, int, String) Overloaded constructor toString Method Create second class Vehicle type, horse_power, array of Car class type, count (String, int. Car, int) Overloaded constructor (set car array size to 5) AddCar(name, model, color) method Add RemoveCar() method in previous lab program. Add searchCar() method in Vehicle class that will return true if the car is available in the car array otherwise false. The searchCar() takes one String parameter 'car_name' Create third class Main Create object of Vehicle class - Call AddCar method and add 5 cars by giving name, model, and color value Print all the vehicle details Remove a car by calling removeCar0 method. - Display Vehicle after deleting a car Search a car. If the car is available, display all the details of that car. Sub Task 1.1: In the previous program add one more static integer variable in Vehicle class called NUMBER_OF_CAR = 0. In the constructor of Vehicle, class increment NUMBER_OF_CAR. Add a static method in Vehicle class called NumberOfCars that will return NUMBER_OF_CAR value. In the AddCar method of Vehicle class check whether the array of Car object array is full or not. If it is full, display a message called 'Class is full', otherwise add the Car to the array Display the all the added car details by calling toString method

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

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions