C#
1. Write a program that demonstrates the use of four basic principles of object-oriented programming: Abstraction, Encapsulation, Inheritance, and Polymorphism.
2. Use Abstraction to define different classes for each person type, such as Student and Instructor. These classes should have behavior specific to that type of person.
3. Use Encapsulation to keep many details private in each class.
4. Use Inheritance by leveraging the implementation already created in the Person class to save code in the Student and Instructor classes.
5. Use Polymorphism to create virtual methods that derived classes could override to create specific behavior, such as salary calculations.
6. Make sure to create appropriate interfaces, such as ICourseService, IStudentService, IInstructorService, IDepartmentService, IPersonService. IPersonService should have person-specific methods. IStudentService and IInstructorService should inherit from IPersonService.
Person:
- Calculate the age of the person
- Calculate the salary of the person (use decimal for salary)
- Salary cannot be a negative number
- Can have multiple addresses (should have a method to get addresses)
Instructor:
- Belongs to one department and can be the head of the department
- Will have an added bonus salary based on their experience (calculate years of experience based on join date)
Student:
- Can take multiple courses
- Calculate student GPA based on grades for courses
- Each course will have a grade from A to F
Course:
- Will have a list of enrolled students
Department:
- Will have one instructor as the head
- Will have a budget for the school year (start and end DateTime)
- Will offer a list of courses