Lab 5D
Note
- Remember, composition is a has a relationship vs a is a relationship. A what it can do vs what it is.
- A dog can eat
- A dog can poop
- A dog can run
- A cat can eat
- A cat can poop
- A cat can run
- A dog can bark
- A cat can meow
- OR
- A pickup truck has 2 axles
- A semi-truck has 3 axles
- A van has third row seating
- A sedan has two row seating
Instructions
- Create some vehicle types (start with just a few), pickup truck, semi truck, sedan, sports car, exotic, van, crossover, SUV, etc
- Compose the vehicles of other classes (get creative here, think of things some vehicles have that others don't):
- axles
- seating
- engines
- transmission
- Towing capacity
- Sport ability
- etc
- Compose the vehicles of other classes (get creative here, think of things some vehicles have that others don't):
- Create instances of different types of vehicles, ex:
- pickup truck: Ford F150, Chevy Siverado, etc
- semi truck: International, Peterbilt, Volvo
- sedan: Toyota Corolla, Honda Civic
- etc
- Do these steps last (may take a long time):
- Allow users to create the cars, selecting from a menu of selections to narrow down what type of class to make.
- Save the user vehicles into a file and allow the users to view, delete, add or modify them
Requirments
- Adhere to PEP8 and utilize proper and efficient code
- Input Validation
- Comments
- File usage
- Packages/user modules
- Proper User Class OOP Principles
Additional:
- Convert it to a racing game
Bonus Lab: Janken Pon!
Create a game of Rock, Paper, Scissors using classes.