Note - This is offered to assist you in completing your Cash Register Problem ID 11 The British currency and coinage are different but the concepts are the same.Below is a first pass at the British Change Calculator
It is ready for a walkthrough with the developer team.
Estimated Design cost = 4 Person Hours at 30 USD in USA
Estimated Build/Test cost = 4 Person Hours at 7 USD per hour offshore coding service.
Use Case ID 01 Title British Change Calculator
Goal Provide – Provide Customer Change in British Currency
Trigger – Customer is checking out and requires change in British Notes and or Coins
Preconditions – Customer Charge and Amount Tendered are known
Successful End - Correct change is given.
User (Desk Clerk) / System1. Enters SalesAmount
2. Enters TenderedAmount
3. Presses Change Button
Subtracts SalesAmount from TenderedAmount giving Change
Convert Change to Pence
If change is < 0 As Customer to Increase TenderedAmount
If Change > 50 Pounds (5000p) Then Call manager
If change = 0 then end
Determine 20,10,5 Pound Notes
Determine all coinage to be dispensed
PDL Title British Change Calculator PDL
// This is a comment line and needs no code.
// Please review the Calculator Form
// c01P is a 1 Pence coin ….. c2P (a 2 Pound Coin)
// 5pn, 10pn , 20pn Pound Notes
Sub ComputeChange()
Define AmountTendered, SaleAmount as Single
Define change as Int16
Define c01p, c02p, c05p, c10p,c20p, c50p ,c1Pound,c2Pound as byte
Define fiveNote, tenNote, twentyNote as byte
change = (AmountTendered – SaleAmount) * 100 // Now in pence
If change < 0 then Display message asking for more money
If change = 0 then Display message Thanking the Customer
While change >2000
TwentyNote += 1
change -= 2000
End While
If change > = 1000 then
TenNote = 1
Change -= 1000
End If
If change > = 500 then
fiveNote = 1
Change -= 500
End If
While change >200
c2Pound += 1
change -= 200
End While
While change >100
c1Pound+= 1
change -= 100
End While
If change > 50 then
c50P = 1
change -=50
EndIf
While change >20
c20p+= 1
change -= 20
End While
If change > 10 then
c10P = 1
change -=10
EndIf
If change > 10 then
c10P = 1
change -=10
EndIf
If change > 5 then
c05P = 1
change -=5
EndIf
While change >2
c02p+= 1
change -= 2
End While
c01p = change
Place c01p, c02p, c05p, c10p,c20p, c50p ,c1Pound,c2Pound into their form labels
Place fiveNote, tenNote, twentyNote into their form labels
End Sub