Home » Database » Database miscellaneous » Question

Database miscellaneous

  1. It is desired to design an object-oriented employee record system for a company. Each employee has a name, unique Id and salary. Employees belong to different categories and their salary is determined by their category. The functions get Name, geld and compute salary are required. Given the class hierarchy below, possible locations for these functions are
    1. getId is implemented in the superclass
    2. getId is implemented in the subclass
    3. getName is an abstract function in the superclass
    4. getName is implemented in the superclass
    5. getName is implemented in the subclass
    6. getSalary is an abstract function in the superclass
    7. getSalary is implemented in the superclas
    8. getSalary is implemented in the subclass

    Choose the best design.
    1. 1, 4, 6, 7
    2. 1, 4, 7
    3. 1, 3, 5, 6, 8
    4. 2, 5, 8
Correct Option: A

ID is unique so can be implemented in the superclass.

Name is a function of superclass.
Also, Name can be common/duplicate, so must be implemented in superclass.
Salary is a function of superclass. Also, salary is dependent on the category and hence is implemented in the subclass.



Your comments will be displayed only after manual approval.