Past-paper question · 2019 October-November · Paper 41 · Q1(e)(iv)

Question 1(e)(iv) 2019 · October-November · Paper 41 · 6 marks

Question 1

Part (e)

(iv)

Question 1

Each student at CIE University needs a printing account to print documents from university

computers.

The university is developing software to manage each student’s printing account and the printing process. There are 1000 students at the university. They will each require a printing account.

Students need to buy printing credits that will be added to their account. Each page printed uses one printing credit.

The university needs software to keep track of the number of printing credits each student has in their account. The university has decided to implement the software using object-oriented programming (OOP).

The following diagram shows the design for the class PrintAccount. This includes the attributes and methods.

PrintAccount FirstName : STRING // parameter sent to Constructor() LastName : STRING // parameter sent to Constructor() PrintID : STRING // parameter sent to Constructor() Credits : INTEGER // initialised to 50 Constructor() // instantiates an object of the PrintAccount class, // and assigns initial values to the attributes GetName() // returns FirstName and LastName concatenated // with a space between them GetPrintID() // returns PrintID SetFirstName() // sets the FirstName for a student SetLastName() // sets the LastName for a student SetPrintID() // sets the PrintID for a student AddCredits() // increases the number of credits for a student RemoveCredits() // removes credits from a student account

Question 9

(iv)

The method AddCredits()calculates the number of printing credits a student buys

and adds the printing credits to the student’s account.

  • Credits cost $1 for 25 credits.
  • If a student buys $20 or more of credits in a single payment, they receive an extra
  • 50 credits.

  • If a student buys between $10 and $19 (inclusive) of credits in a single payment,

they receive an extra 25 credits.

Payment from a student is stored in the variable MoneyInput. This is passed as a parameter.

Write program code for AddCredits(). Use constants for the values that do not change.

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

Program code

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[6]

Question 11

Reveal official mark-scheme answer Official mark-scheme answer for 1(E)(IV)Official mark-scheme answer for 1(E)(IV)

Official answer for Question 1

Part (e)

(iv)

Question 1

mark per each correct bullet point from:

Question 6

✓
•
✓
Procedure/method header and close (where necessary) passing MoneyInput
✓
•
✓
At least 3 constants (e.g. freecredit10, freecredit20, twenty, 10, creditperdollar)
✓
•
✓
If MoneyInput<10 calculate MoneyInput * 25
✓
•
✓
If MoneyInput >9 and MoneyInput <20 then calculate MoneyInput * 25 + 25
✓
•
✓
If MoneyInput >19 then calculate MoneyInput * 25 + 50
✓
•
✓
All three correct calculations add to Credits, not overwrite
✓
•
✓
Efficient IF (i.e. elseif)
✓
PYTHON
✓
def __AddCredits(self, MoneyInput):
✓
CreditPerDollar = 25
✓
FreeCredit10 = 25
✓
FreeCredit20 = 50
✓
Twenty = 20
✓
Ten = 10
✓
if MoneyInput >= Twenty:
✓
Credits = Credits + (MoneyInput * CreditPerDollar) + FreeCredit20
✓
elif MoneyInput >= Ten:
✓
Credits = Credits + (MoneyInput * CreditPerDollar) + FreeCredit10
✓
else:
✓
Credits = Credits + (MoneyInput * CreditPerDollar)
✓
9608/41
✓
Cambridge International AS/A Level – Mark Scheme
✓
October/November 2019
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_w19_ms_41.pdf →

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_w19_qp_41.pdf

Keep practising this topic