Asked by PresidentOyster2317
. 1. 1. Create four (4) Java classes named Color, Model, Car, and...
Image transcription text 1.
1. Create four (4) Java classes named Color, Model, Car, and CarDemo.
2. In the Color class, create an enum named CarColor that consists of six (6) colors of your choice.
3. In the Mode/ class, create an enum named CarModel 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 CarModel object named model
. A CarColor object named color
5. Add a constructor for the Car class with three (3) parameters: yr (int), m(CarModel), and c (CarColor). Inside the
constructor, assign yr to year, m to model, and c to color.
6. Add a display( ) method that prints the three (3) Carobject's data.
7. In the main method of the CarDemo class, instantiate two (2) Carobjects 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) Carobjects.
Sample Output:
Car is a 2014 BLUE MINIVAN
Car is a 2017 RED CONVERTIBLE
Answered by SuperBook153
a. Fusce dui l
risus ante, dapibus a
o. Donec aliquet. Lorem ipsu
Unlock full access to Course Hero
Explore over 16 million step-by-step answers from our library
Subscribe to view answercing eli
gue
Donec a
ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio.
gue
onec aliqu
itur laoreet. Nam risus ante, dapibus a molestie consequat, ultrice
gue
ac, dict
, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dict
gue
icitur laore
ur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellen
gue
gue
ac, dictum vit
gue