All pastes #182338 Raw Edit

aRGH!@#@$

public text v1 · immutable
#182338 ·published 2006-09-25 22:51 UTC
rendered paste body
;; Question 3

(define-struct checking (balance numberOfTransactions))
;; checking is a structure: (make-checking balance numberOfTransactions)
;; will create a checking account with a given balance and number of transactions

(define-struct savings (balance numberOfTransactions yearlyInterestRate))
;; savings is a structure: (make-savings balance numberOfTransactions yearlyInterestRate)
;; will create a savings account with a given balance, number of transactions and a
;; yearly interest rate

(define-struct credit (balance creditLimit numberOfTransactions yearlyInterestRate))
;; credit is a structure: (make-credit balance creditLimit numberOfTransactions yearlyInterestRate)
;; will create a credit account with a given balance, credit limit, number of transactions
;; and a yearly interest rate

(define (bank-of-canada-update acct newrate)
  (cond
    [(symbol=? acct 'savings) (make-savings balance numberOfTransactions 
                                  (cond 
                                    [(>= (newrate - 1) 0) (newrate -1)]
                                    [else 0]
                                  ) 
                              )]
    []
    []
  )
) 

(define (withdrawal acct amt)
  ...)

(define (year-end-update acct)
  ...)