Question: CW code in java Create a class Car that stores the make and year Add a static instance field: carsCreated that keeps track of how

CW code in java

Create a class Car that stores the make and year

Add a static instance field: carsCreated that keeps track of how many cars have been created so far. The constructors should update this field

Write the set/get methods for make and year

Implement the default constructor

Implement a constructor that takes the make and year

Implement the copy constructor

Implement the equals method

Implement the toString method

Write a main method that:

Creates a Car, c1, using the default constructor. Use the set methods to set the make and year.

Creates a Car, c2, using the constructor that takes the make and year

Creates a Car, copy, which is a copy of c2, using the copy constructor

Test if copy and c2 are the same using the equals method and print whether they are equal or not

- Print c1, c2 and copy

Write a class Maker that stores two strings: make and model.

Modify the Car class written in CW to store a Maker object that stores the make and model of the Car.

Write the necessary methods in Maker

Modify the necessary code in Car to get the same code written in the CW to compile and run

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!