Past-paper question · 2015 May-June · Paper 42 · Q4(b)

Question 4(b) 2015 · May-June · Paper 42 · 5 marks

Original past-paper question for 4(B)
Original past-paper question for 4(B)
Reveal official mark-scheme answer Official mark-scheme answer for 4(B)Official mark-scheme answer for 4(B)

Official answer for Question 4

Part (b)

Part (b)

Example Pascal

✓
Type
✓
Employee = CLASS
✓
PUBLIC
✓
procedure SetEmployeeName
✓
Procedure SetEmployeeID
✓
Procedure CalculatePay
✓
PRIVATE
✓
EmployeeName : STRING
✓
EmployeeID : STRING
✓
AmountPaidThisMonth : Currency
✓
END;
✓
Mark as follows:
✓
Class header
✓
(1 mark)
✓
PUBLIC and PRIVATE used correctly
✓
(1 mark)
✓
EmployeeName + EmployeeID
✓
(1 mark)
✓
AmountPaidThisMonth
✓
(1 mark)
✓
Methods x 3
✓
(1 mark)
✓
Example VB
✓
Class Employee
✓
Private EmployeeName As String
✓
Private EmployeeID As String
✓
Private AmountPaidThisMonth As Decimal
✓
Public Sub SetEmployeeName()
✓
End Sub
✓
Public Sub SetEmployeeID()
✓
End Sub
✓
Public Sub CalculatePay()
✓
End Sub
✓
Example Python
✓
Class Employee():
✓
def __init__(self):
✓
self.__EmployeeName = ""
✓
self.__EmployeeID = ""
✓
self.__AmountPaidThisMonth = 0
✓
def SetEmployeeName(self, Name):
✓
self.__EmployeeName = Name
✓
def SetEmployeeID(self, ID):
✓
self.__EmployeeID = ID
✓
def SetAmountPaidThisMonth(self, Paid):
✓
self.__AmountPaidThisMonth = Paid
✓
[max 5]
✓
Mark Scheme
✓
Syllabus
✓
Paper
✓
Cambridge International A Level – May/June 2015
✓
9608

Question 42

Mark scheme 9608_s15_ms_42.pdf →

Show text version of question

Question 4

Part (b)

Question 4

A payroll program is to be written using an object-oriented programming language. An Employee

class is designed. Two subclasses have been identified:

  • HourlyPaidEmployee who is paid a monthly wage calculated from their hourly rate of pay
  • and the number of hours worked during the month

  • SalariedEmployee who is paid a monthly wage which is one 12th of their annual salary

Part (b)

The design for the Employee class consists of:

  • properties
  • EmployeeName
  • EmployeeID
  • AmountPaidThisMonth
  • methods
  • SetEmployeeName
  • SetEmployeeID
  • CalculatePay

Write program code for the class definition of the superclass Employee.

Programming language .............................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

..............................................................................................................................................

[5]

Question 9

Topic relevance

Why this question appears here

98% assigned-topic match · Further programming › Programming paradigms

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9608_s15_qp_42.pdf

Keep practising this topic