Asmodasis / CS491-hw1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Homework 1

Party on!

Problem

  • Implement a simple car class for Wayne’s ford pinto and a bicycle class for Garth’s BMX bike. Create constructors for each class. Use a file with a main method to instantiate/test each class.

  • Think of a set of useful properties (color? name?) for each class. Should these properties be private or public? implement getters and setter when appropriate.

  • Think of a set of useful methods (start()? pedal()?) for each class.

  • Sometimes classes are composed with entities that are not expressible using Python data type (e.g. integer, string). For example, a car and bike both have wheels or a car has an engine. Create classes for each entity and use composition to add them to your car or bicycle class. You may use the same wheel class for cars and bikes.

  • Abstract both classes into a vehicle class. Should this class be abstract or not? Figure out what methods and properties should go in the vehicle class and what should stay in the car and bicycle class.

About