Question: java 1. [3 mark] Define a class for: o Engine with two private variables: maker (String) and cylinder (int). Write a constructor with two parameters.

java

java 1. [3 mark] Define a class for: o "Engine" with two

1. [3 mark] Define a class for: o "Engine" with two private variables: maker (String) and cylinder (int). Write a constructor with two parameters. The first parameter should initialize the maker variable and the second parameter should initialize the cylinder variable. The cylinder value must be an even number between 2 and 12. o Write the setters and getters methods making sure to set the cylinder value to a valid number (even number between 2 and 12) 2. [2 marks] Define a class for: "Car with two private variables: carEngine (Engine) and price (double). o Write a constructor with two parameters. The first parameter should initialize the carEngine variable and the second parameter should initialize the price variable 4.[1 marks) in a test class with main method, write a code to create a Car object with Engine: Honda, 6 and price 75000 For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). BI U S Paragraph Arial 14px E > v T %

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!