Partial preview of the text
Download Bài tập môn Object Oriented Programming 1651 and more Exercises Object Oriented Programming in PDF only on Docsity!
Inheritance Exercise Simple School Management System 1. Create a C# program that prompts the user for three names of people and stores them in an array of Person-type objects. There will be two people of the Student type and one person of the Teacher type. To do this, create a Person class that has a Name property of type string, a constructor that receives the name as a parameter and overrides the ToString () method. Then create two more classes that inherit from the Person class, they will be called Student and Teacher. The Student class has a Study method that writes by console that the student is studying. The Teacher class will have an Explain method that writes to the console that the teacher is explaining. Remember to also create two constructors on the child classes that call the parent constructor of the Person class. End the program by reading the people (the teacher and the students) and execute the Explain and Study methods. Input Juan Sara Carlos Output Explain Study Study 2. Create the Course class, with the attributes: name, a teacher in charge, and the students taking the course. Each student has a midterm and final score. A student passes the course if the total score is greater than or equal to5. The Course class has the following methods: 1651. Advanced Programming Page 1/2