Design and implement a class called Car that contains instance data that represents the company, price, model, and year of the car. Define the Car constructor to initialize these values. Include getter and setter methods for all instance data, and a toString method that returns a one-line description of the car. Create a driver class called CarTest, whose main method instantiates array of Car objects and write the following methods: 1) Methods that receives an array of cars and a string called co and returns an array that contains cars whose company equal to co. 2) A Method called getTopByCompany that receives an array of Cars and then returns an array of cars containing the cars that have the highest price compared with cars from the same company.
Design and implement a class called Car that contains instance data that represents the company, price, model, and year of the car. Define the Car constructor to initialize these values. Include getter and setter methods for all instance data, and a toString method that returns a one-line description of the car. Create a driver class called CarTest, whose main method instantiates array of Car objects and write the following methods:
1) Methods that receives an array of cars and a string called co and returns an array that contains cars whose company equal to co.
2) A Method called getTopByCompany that receives an array of Cars and then returns an array of cars containing the cars that have the highest price compared with cars from the same company.
Step by step
Solved in 2 steps