Challenge for Accessors and Mutators

Challenge

Fill in the two accessors (getSpeed and getColor) and one mutator (accelerate) in the code below. The accessors should simply return the speed and color of the Car. The mutator accelerate should modify the speed by the provided amount. However, if the change will cause the speed to be less than 0 or greater than 140 it should do nothing.

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Contact Us
Sign in or email us at [email protected]