This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS 135 Fall 2011 Becker, Goldberg, Kaplan, Tompkins, Vasiga Assignment: 4 Due: Tuesday, October 11, 2011 9:00pm Language level: Beginning Student Allowed recursion: Structural recursion Files to submit: accounts.rkt , daily-balance.rkt , area.rkt Warmup exercises: HtDP 8.7.2, 9.1.1 (but use box-and-pointer diagrams), 9.1.2, 9.5.3 Practice exercises: HtDP 8.7.3, 9.5.4, 9.5.6, 9.5.7 Overall instructions for this assignment are the same as previous assignments except you will note a new addition at the top: “Allowed recursion” restricts you to structural recursion – recursion that follows the data definition of the data it consumes. Here are the assignment questions you need to submit. 1. Perform the Assignment 4 questions using the online evaluation “Stepping Problems” tool linked to the course web page and available at https://www.student.cs.uwaterloo.ca/ ˜ cs135/stepping The instructions are the same as A03; check there for more information, if necessary. Re- minder: You should not use DrRacket’s Stepper to help you with this question, for a few reasons. First, as mentioned in class, DrRacket’s evaluation rules are slightly different from the ones presented in class; you are to use the ones presented in class. Second, in an exam sit- uation, of course, you will not have the Stepper to help you. Third, you can re-enter steps as many times as necessary to get them correct, so you might as well maximize the educational benefit. Problems 2 and 3 will make use of the following data definition: A Balance is a number, b , with at most two decimal places (that is, 100 * b is an integer). 2. The local bank offers three types of accounts: • A chequing account has a balance (the amount of money currently in the account) and a count of the number of cheques that have been written in the current month. For simplicity, funds may only be withdrawn via a cheque. A chequing account’s balance may not be less than $0.00. • A line-of-credit account has a balance, a credit limit, and a monthly interest rate. The credit limit is a non-negative number indicating the amount of money that may be borrowed. That is, the account’s balance may not be less than $-credit limit . CS 135 — Fall 2011 Assignment 4 1 • A savings account has a balance, a type that is either ’ RegularInterest or ’ HighInter- est , a count of the number of transactions, and the minimum balance that has occurred during the current month. The transaction count and minimum balance are both reset at the end of each month. A high interest savings account is restricted to at most five transactions per month. A savings account’s balance may not be less than $0.00. Purpose statements and examples/tests are provided for you on the course website’s assign- ments page. You will need to add data definitions, templates, contracts, and function defini- tions. These are provided with two goals in mind: • To demonstrate the advantages of developing code with examples and tests written...
View Full Document
- Fall '07
- Recursion, Web page, Negative and non-negative numbers, EPI