0% found this document useful (0 votes)
24 views

OOPs With Inheritance - 3 (Employee - Manager)

A level Computer Science Paper 4 Question

Uploaded by

Sooraj Rajmohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

OOPs With Inheritance - 3 (Employee - Manager)

A level Computer Science Paper 4 Question

Uploaded by

Sooraj Rajmohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

OOPs with Inheritance_3(Employee_Manager)

(c) The main program has a global 1D array, EmployeeArray, to store data about eight

employees. Each employee is stored as an object of type Employee.


The following data should store in a normal 1D array EmployeeArray. The following data
is in the order
• hourly pay
• employee number
• bonus value (where included, if title contains manager)
• job title
HourlyPay EmployeeNumber BonusValue JobTitle
15.22 12452 0 Junior Developer
17.80 21548 0 Web Developer
22.50 02586 5.25 Interface Manager
12.50 65912 0 Assistant Tester
33.49 42004 2.00 Team Leader
10.57 82610 Intern
21.58 51947 10.50 Junior Testing
Manager
31.59 51847 Analyst
Only employees who are managers have a bonus value saved. For example:
• The first employee is a Junior Developer, with employee number 12452 and an hourly
pay of $15.22. This employee does not have a bonus value.
• The third employee is an Interface Manager, with employee number 02586 and an
hourly pay of $22.50. This employee has a bonus value of 5.25%.
(i) Write the main program to:
• declare the array to store data about 8 employees
• instantiate each employee as either Employee (if the employee does not have a
bonus value) or Manager (if the employee has a bonus value).

Initialize the array EmployeeArray values with the help of the above table.
For example,
For Normal Employee
EmployeeArray.append(Employee(15.22,12452,”JuniorDeveloper”))

For Manager
EmployeeArray.append(Manager(22.50,02586,5.25,”Inteface Manager”))
(ii) A program to store the number of hours each employee has worked in week 1.

The procedure EnterHours():


• Prompt and ask the user to input the employee number and hours worked from the following
table.( for 8 employees)
EmployeeNo 21548 12452 51947 82610 02586 65912 42004 51847
Hours
50.0 48.0 51 47.5 28.5 38.0 22.5 10.0
WOrksed

• finds the location of each employee in EmployeeArray .


• calls the method SetPay() for each employee. Write program code for EnterHours().

(d) (i) The main program needs to call EnterHours() and use the method GetTotalPay()
to output the employee number and total pay for each of the eight employees.
Amend the main program to perform these tasks.
(ii) Test your program. Take a screenshot of the output.
========================

You might also like