Challenge: Classes and Their Attributes

Let us practice how to create a class with its instance variables and then create its object.

We'll cover the following

Requirements

Design a Car class that will have 3 private member variables: wheels, speedometer, and engine. The class will have 2 methods, as defined below:

  • print_wheels(): This method prints the number of wheels of the car.
  • stop(): This method will reset the speedometer reading of the car object to 0 and print a message indicating that car has been stopped.

Create an object of this class and call the class methods.

Write your pseudocode in the playground below keeping these requirements in mind.

Get hands-on with 1200+ tech skills courses.