Page 480 - Computer science 868 Class 12
P. 480
3. The ………………… keyword is also used to invoke a parent class constructor.
4. ………………… are accessible inside their own class, classes within the package and subclasses.
5. ………………… are accessible in all the classes within or outside the package.
6. ………………… is a combination of two or more inheritances like multiple and hierarchical, multiple and multilevel.
7. ………………… is a programming technique which allows multiple methods of a class to have the same name, but different signatures.
8. A class declared with final keyword cannot be ………………… .
9. An ………………… has no constructors as it cannot create objects.
10. ………………… methods are the methods with only method declaration but no method body.
C. Answer the following questions:
1. A class Sale contains employee and sale details of a salesman for the first quarter of 2022. Another class Commission calculates
commission received on sale. The details of the two classes are given below.
Class name : Sale
Data Members
empno : stores the employee number
empName : stores the employee name
saleamt : total sales of a salesman in the first quater of 2022
Member Functions
Sale(....) : parameterised constructor to assign values to data members
void display() : displays the employee and sale details
Class name : Commission
Data Members
com : double type variable to store commission
Member Functions
Commission (....) : parameterised constructor to assign values to data members of both classes
void calculate() : calculates the commission received by the salesman according to the
following rules:
Sale amount Commission %
Upto 500000 10%
500001 to 1000000 17.5%
1000001 to 1500000 20%
Beyond 1500000 25%
void display() : displays the employee details and commission received by the salesman
Using the concept of inheritance, specify the class Commission giving details of the constructor and the member functions void
calculate() and void display(). Base class and main method need not to be written.
2. A class Student contains marks of a student in five subjects stored in a one dimensional array. Another class Grade calculates the
average marks and grade obtained by the student. The details of the two classes are given below.
Class name : Student
Data Members
sroll : stores roll number of the student
sname : stores student’s name
mark[] : double array to store marks in five subjects. Maximum marks in each
subject is 100
Member Functions
Student (....) : parameterised constructor to assign values to data members
void display() : displays the student details
478478 Touchpad Computer Science-XII

