Implement the below class. Car - plateNumber: String - horsePower: int - year: int - nbCarsCreated: int + Car(p: String, hp: int, y: int) + Getters/Setters + calculateMechanicDues(): int + toString( ): String Implement the class Car as follows: 1. The data field nbCarsCreated keeps tracking the number of cars created. 2. The constructor accepts String parameter p for the plate number, an integer parameter hp for the horse power, and an integer parameter y for the manufacturing year. 3. Implement the appropriate getter and setter for each data field. 4. The method calculateMechanicDues calculates the amount of mechanic dues as described in the following table: Year Mechanic dues amount for each horse power unit Below 2007 10,000 L.P. 2007 – 2015 20,000 L.P. Above 2015 30,000 L.P. 5. The toString method returns a String that describes a car with the following format: Plate number: T123456, Power: 41 horses, Model: 2012
Implement the below class.
Car
- plateNumber: String
- horsePower: int
- year: int
- nbCarsCreated: int
+ Car(p: String, hp: int, y: int)
+ Getters/Setters
+ calculateMechanicDues(): int
+ toString( ): String
Implement the class Car as follows:
1. The data field nbCarsCreated keeps tracking the
number of cars created.
2. The constructor accepts String parameter p
for the plate number, an integer parameter hp
for the horse power, and an integer parameter
y for the manufacturing year.
3. Implement the appropriate getter and
setter for each data field.
4. The method calculateMechanicDues calculates the amount of
the following table:
Year Mechanic dues amount for each horse power unit
Below 2007 10,000 L.P.
2007 – 2015 20,000 L.P.
Above 2015 30,000 L.P.
5. The toString method returns a String that describes a car with the following format:
Plate number: T123456, Power: 41 horses, Model: 2012
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images