Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define tries 7)
- (define bal 0)
- (define password1 0)
- (define (make-secure-account password balance)
- (set! password1 password)
- (set! bal balance)
- (define (object pw withdraw)
- (cond ((not (equal? password1 pw)) (begin (set! tries (- tries 1))
- (if (<= tries 0)
- (call-the-cops)
- "Wrong password!")))
- ((>= bal withdraw) (begin (set! bal (- bal withdraw))
- (set! tries 7)
- bal))
- (else (begin (set! tries 7)
- "Insufficient funds!"))))
- object)
- ; (define test1 (make-secure-account 12345 1000))
Advertisement
Add Comment
Please, Sign In to add comment