Import JJIO Class Account -- Name jmotil -- Does provide a simple bank account -- Data attributes Box balance ofType real is private -- dollar amount Box identity ofClass Str is private -- identification Constructor Account (b, i) is public Slot b ofType real -- balance Slot i ofClass Str -- identity -- Does: initialize or open the account Set balance = b Set identity = i EndConstructor Account Routine setBalance (amount) is public Slot amount ofType real -- Does: set the amount of balance Set balance = amount EndRoutine setBalance Function getBalance (none) ofType real is public Box result ofType real -- Does: return balance in account Set result = balance EndFunction getBalance Routine credit (amount) is public Slot amount ofType real -- Does: deposit an amount into account If (amount > 0.00) then Set balance = balance + amount Else Outputln "Negative amount!" EndIf EndRoutine credit Routine debit (amount) is public Slot amount ofType real -- Does: withdraw an amount from account If (amount > balance) then Outputln "Insufficient balance!" Else Set balance = balance - amount EndIf EndRoutine debit Routine show (none) is public -- Does: Display the account Output "Account " + identity + " has balance of " Outputln balance EndRoutine show Function covers (amount) ofType bool is public Slot amount ofType real Box result ofType bool -- Does tell if balance covers amount Set result = (balance >= amount) EndFunction covers Routine test (none) is private Box his ofClass Account Box her ofClass Account -- Does: test Account class Start New his ofClass Account with (200.00, "abc") New her ofClass Account with ( 0.00, "xyz") Call her.setBalance with (200.00) Call her.debit with (100.00) Call her.credit with (300.00) Call her.show Call his.debit with (400.00) Call his.credit with (-50.00) Call his.show EndRoutine test EndClass Account A run: Account xyz has balance of 400.0 Insufficient balance! Negative amount! Account abc has balance of 200.0