Question: 1. Develop four (4) Java classes named Color, Model, Car, and CarDemo. 2. In the Color class, create an enum named Color that consists

1. Develop four (4) Java classes named Color, Model, Car, and CarDemo.

1. Develop four (4) Java classes named Color, Model, Car, and CarDemo. 2. In the Color class, create an enum named Color that consists of six (6) colors of your choice. 3. In the Model class, create an enum named Model that contains the following values: SEDAN, SUV, CONVERTIBLE, and HATCHBACK. 4. In the Car class, declare three (3) private fields: int variable named year A Model object named model A Color model named color 5. Add a constructor for the Car class with three (3) parameters: yr (int), model (Model), and color (Color). Inside the constructor, assign yr to year, m to model, and c to color. 6. Add a display() method that prints the three (3) Car object's data. 7. In the main method of the CarDemo class, instantiate two (2) Car objects assigning values to them using enumeration values for the models and colors. Example: Car car1 = new Car(2014, Model.SUV, Color.RED); 8. Add two (2) statements to display the data of the two (2) Car objects. Act

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the implementation of the four Java classes as described java Colorjava public enum Color RED ... View full answer

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 Programming Questions!