Question: 1. Define a SCHEME function named make-checking which takes one parameter, a beginning balance and repre- sents a checking account object. This checking account object

1. Define a SCHEME function named make-checking which takes one parameter, a beginning balance and repre- sents a checking account object. This checking account object should store the beginning balance along with any and all transactions that have been posted to the account. You may also wish to store the current balance separately. The checking account object should expose functions for depositing funds, writing a check, return- ing an account statement and returning the current balance. When returning an account statement, the object should evaluate to a string containing the beginning balance, each transaction in the order it was posted to the account, and the current balance as shown below. You must also use the tokens as named in the example below to retrieve your functions from the dispatcher for your object Note: You will want to make use of the number->string function that produces a string containing the decimal representation of the number. Also, the string-append function can take several strings as parameters and produces one string which is the concatenation of all the strings passed as parameters. >(define checking (make-checking 100)) ((checking ,write-check) 10) > ((checking 'write-check) 10) >((checking 'deposit) 100) ((checking 'write-check) 10) >(display ((checking 'print-statement))) ((checking ,balance)) beginning balance: 100 transaction: check amount: -10 transaction: check amount: -10 transaction: deposit amount: 100 transaction: check amount: -10 balance: 170 170
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
