Mixed data: bank accounts

posted by: Ms. Martin 21 September 2010 No Comment

A bank offers two kinds of accounts: checking and savings. Checking accounts contain a customer’s name and current balance. Savings accounts contain a customer’s name, current balance, and the number of withdrawals made so far this month.

  1. Develop data definitions for accounts. Provide examples for every define-struct that you write (you will write more than one).
  2. Write a function enough-funds? that consumes an account and the amount that the customer wants to withdraw from the account and produces a boolean indicating whether the account has enough funds to cover the withdrawal plus fees (if applicable). Savings account holders pay a $1 fee if they have done more than 4 withdrawals during the month. No fees apply to checking accounts.
  3. Write a function start-month that consumes an account and produces an account. If the original account is a checking account, the new account balance is 1.5% higher. If the original account is a savings account, the new account balance is 3% higher and the number of withdrawals made is zero.
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>