(define (make-account balance password) (define (withdraw amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) "Insufficient funds")) (define (deposit amount) (set! balance (+ balance amount)) balance) (define wrong-guesses 0) (define (dispatch credential m) (define (call-the-cops) (display "Calling the cops")) (if (eq? credential password) (set! wrong-guesses 0) (begin (set! wrong-guesses (+ wrong-guesses 1)) (if (> wrong-guesses 7) (call-the-cops)) (error "Incorrect password"))) (cond ((eq? m 'withdraw) withdraw) ((eq? m 'deposit) deposit) (else (error "Unknown request -- MAKE-ACCOUNT" m)))) dispatch)