Lab 6
-
Create a class hierarchy for shapes, starting with a base class Shape. Then, create subclasses like Circle, Rectangle, and Triangle. Implement methods to calculate area and perimeter for each shape.
-
Design a bank account system with a base class Account and subclasses SavingsAccount and CheckingAccount. Implement methods for deposit, withdrawal, and interest calculation.
-
Create a base class Vehicle with attributes like make, model, and year, and then create subclasses for specific types of vehicles like Car, Motorcycle, and Truck. Add methods to calculate mileage or towing capacity based on the vehicle type.
-
Build an employee hierarchy with a base class Employee. Create subclasses for different types of employees like Manager, Engineer, and Salesperson. Each subclass should have attributes like salary and methods related to their roles.
-
Create a class hierarchy for animals, starting with a base class Animal. Then, create subclasses like Mammal, Bird, and Fish. Add properties and methods to represent characteristics unique to each animal group.
-
Design a library catalog system with a base class LibraryItem and subclasses for different types of items like Book, DVD, and Magazine. Include methods to check out, return, and display information about each item.