Sedan needs to satisfy more than the highway patrol’s rules (the
IAutomobile interface). The car designers have asked that sedans are built and move in certain ways — it must have constructors and methods that aren’t required by the
IAutomobile interface. This is okay in C#! The interface says what a class MUST have. It does not say what a class MUST NOT have.
In fact, interfaces cannot specify two types of members that are commonly found in classes:
Add a constructor to the
Sedan class with one parameter,
speed, of type
double. It should
- set the
- set a random
To make a random license plate, a utility class is provided for you. Use it in the constructor like so:
void SpeedUp() method that increases the
Speed property by
Did you get an error? There is no setter for the
Speed property. Add a private setter to that property.
void SlowDown() method that decreases the