Electric cars are able to regenerate energy during braking. Given a Car class, create an Ev subclass
Fantastic news! We've Found the answer you've been seeking!
Question:
Electric cars are able to regenerate energy during braking. Given a Car class, create an Ev subclass that inherits from Car. The Ev class also has an int batteryLevel field. Override the brake method and increase the Ev's battery level by 5, in addition to increasing the braking amount 5.
class Vehicle{ int speed = 20; public void brake(int brakingForce){ speed -= brakingForce; } }
(Perform it in Java)
Related Book For
Posted Date: