Олимпиадный тренинг

Задача . 25


Задача

Темы:
A programmer has the task of maintaining a database of students of a large university. There are two types of students, undergraduates and graduate students.
About a third of the graduate students are doctoral candidates.
All of the students have the same personal information stored, like name, address, and phone number, and also student information like courses taken and
grades. Each student’s GPA is computed, but differently for undergraduates and
graduates. The doctoral candidates have information about their dissertations
and faculty advisors.
The programmer will write a C# program to handle all the student information. Which of the following is the best design, in terms of programmer efficiency
and code reusability? Note: { ... } denotes class code.

(A) public interface Student { ...}
public class Undergraduate implements Student { ... }
public class Graduate implements Student { ... }
public class DocStudent extends Graduate { ... }

(B) public abstract class Student { ...}
public class Undergraduate : Student { ... }
public class Graduate : Student { ... }
public class DocStudent : Graduate { ... }

(C) public class Student { ...}
public class Undergraduate : Student { ... }
public class Graduate : Student { ... }
public class DocStudent : Graduate { ... }

(D) public abstract class Student { ...}
public class Undergraduate : Student { ... }
public class Graduate : Student { ... }
public class DocStudent : Student { ... }

(E) public interface PersonalInformation { ... }
public class Student : PersonalInformation { ...}
public class Undergraduate : Student { ... }
public abstract class Graduate : Student { ... }
public class DocStudent : Graduate { ... }

time 1000 ms
memory 32 Mb
Правила оформления программ и список ошибок при автоматической проверке задач

Статистика успешных решений по компиляторам
Комментарий учителя