Log in from a computer to take this course

You'll need to log in from a computer to start Learn C#. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store

The car designers have asked that trucks act a bit differently from sedans. Trucks need a new property called Weight. Whenever a truck is constructed, its number of wheels will depend on its weight. For example, a heavier truck might need 12 instead of 8 wheels to support itself.

Just like sedans, trucks will also SpeedUp() and SlowDown().



Add a public double Weight property with just a getter.


Add a constructor to the Truck class with two parameters: double speed and double weight. It should:

  • Set the Speed property using speed
  • Set the Weight property using weight
  • Set a random LicensePlate value using Tools.GenerateLicensePlate()
  • Set Wheels to 8 if Weight is less than 400 and set Wheels to 12 otherwise

Add a void SpeedUp() method that increases the Speed property by 5.


Did you get an error? There is no setter for the Speed property. Add a private setter to that property.


Add a void SlowDown() method that decreases the Speed by 5.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?