-
Class Definition:
- Define a class named
Carwith attributes such asmake,model, andyear. - Write a method within the class to display information about the car.
- Define a class named
-
Object Creation:
- Create an object of the
Carclass. - Set values for the attributes and call the method to display the car information.
- Create an object of the
-
Constructor Implementation:
- Modify the
Carclass to include a constructor that initializes the attributes. - Create multiple objects using the constructor.
- Modify the
-
Inheritance Setup:
- Create a parent class named
Vehiclewith attributes common to various vehicles. - Create a child class named
Carthat inherits fromVehicleand adds specific attributes for cars.
- Create a parent class named
-
Method Overriding:
- Define a method in the
Vehicleclass and override it in theCarclass. - Demonstrate method overriding by creating objects of both classes and calling the methods.
- Define a method in the
-
Abstract Class Setup:
- Create an abstract class named
Shapewith an abstract methodcalculate_area. - Create two subclasses (
CircleandRectangle) that inherit fromShapeand implement thecalculate_areamethod.
- Create an abstract class named
-
Shape Calculation:
- Create objects of both
CircleandRectangleclasses. - Call the
calculate_areamethod for each object and print the results.
- Create objects of both
-
Encapsulation Implementation:
- Create a class named
Employeewith private attributes such asname,salary, anddesignation. - Write getter and setter methods to access and modify these attributes.
- Create a class named
-
Data Validation:
- Implement data validation in the setter methods to ensure that the salary is positive and the designation is a valid job title.
- Demonstrate these validations by creating objects and attempting to set invalid values.
- Encourage students to use meaningful variable names and provide comments explaining their code.
- Remind students to handle class initialization and method calls appropriately.
- Emphasize the importance of proper indentation in Python.
- Encourage experimentation with different scenarios to ensure the correctness of the code.
- Provide feedback on the usage of classes, objects, constructors, inheritance, abstract classes, and encapsulation in their solutions.