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](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4eed45359e_95566f4eed3bd23f.jpg)
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
Get step-by-step solutions from verified subject matter experts
