Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

pls use java as easy as possible P1: Enumerated Types as Separate Files Create an enum of CarType holding names of different types of cars.

pls use java as easy as possible

P1: Enumerated Types as Separate Files

Create an enum of CarType holding names of different types of cars. Save the file with the same name as CarType.java (include only the enum declaration, do NOT include a class header).

Create another enum of CarColor holding colors for cars. Save the file with the same name as CarColor.java (include only the enum declaration, do NOT include a class header).

Write a class SportsCar that has following three private fields: make a CarType variable, color a CarColor variable and price a double variable.

The class should have following methods.

  • a constructor with three arguments that sets the values for make, color and price
  • getMake method: returns the make of car
  • getColor method: return the color of car
  • getPrice method: returns the price of the car
  • toString method

Write a demo program to test the class.

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

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

5. How do instructional objectives help learning to occur?

Answered: 1 week ago

Question

4. Help trainees set challenging mastery or learning goals.

Answered: 1 week ago