Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your tasks: Use a constructor function to implement an Electric Car ( called ' EV ' ) as a child class of 'Car'. Besides a
Your tasks:
Use a constructor function to implement an Electric Car called EV as a child "class" of 'Car'. Besides a make and current speed, the EV also has the current battery charge in charge property
Implement a 'chargeBattery' method which takes an argument 'chargeTo' and sets the battery charge to 'chargeTo'
Implement an 'accelerate' method that will increase the car's speed by and decrease the charge by Then log a message like this: 'Tesla going at with a charge of
Create an electric car object and experiment with calling 'accelerate', 'brake' and 'chargeBattery' charge to Notice hat happens when you 'accelerate'!
Test data:
Data car : 'Tesla' going at with a charge of
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started