Question: Getting Started Launch the DrRacket IDE. If necessary, configure DrRacket so that the programming language is Racket. To do this, select Language > Choose Language

 Getting Started Launch the DrRacket IDE. If necessary, configure DrRacket sothat the programming language is Racket. To do this, select Language >

Getting Started Launch the DrRacket IDE. If necessary, configure DrRacket so that the programming language is Racket. To do this, select Language > Choose Language from the menu bar, then select The Racket Language in the Choose Language dialog box. #lang racket should appear at the top of the definitions area. Don't delete this line. Do not use special forms that have not been presented in lectures. Specifically, Do not use set! to perform assignment; i.e., rebind a name to a new value. Do not use let expressions to create local variables. Do not use begin expressions to group expressions that are to be evaluated in sequence. Exercise 1 (5 mark) The local supermarket needs a program that can compute the value of a bag of coins. Define procedure sum-coins. It consumes four numbers: the number of pennies, nickels, dimes, and quarters in the bag. Its result is the amount of money in cents. Test your procedure by typing these expressions in the interactions window: (sum-coins 1 0 0 0) ; result should be 1 (sum-coins 0 1 0 0) ; result should be 5 (sum-coins 0 0 1 0) ; result should be 10 (sum-coins 0 0 0 1) ; result should be 25 (sum-coins 1 1 1 1) ; result should be 41 Exercise 2(5 marks) Define procedure interest. It consumes a bank account balance (the amount of money in the account), and calculates the amount of interest that the money earns in one year. The bank pays a flat 4% for balances up to $1,000, a flat 4.5% per year for balances above $1000 and up to $5,000, and a flat 5% for balances of more than $5,000. Test your procedure by typing these expressions: (interest 500) ; result should be 20 (interest 1000); result should be 40 (interest 2000) ; result should be 90 (interest 5000) ; result should be 225 (interest 10000); result should be 500 Exercise 3 (5 marks) Define procedure balance. It consumes a bank account balance (the amount of money in the account), and new balance after adding the annual amount of interest according to the rules in Exercise 2. Test your procedure by typing these expressions: (balance 500) ; result should be 520 (balance 1000); result should be 1040 (balance 2000); result should be 2090 (balance 5000) ; result should be 5225 (balance 10000); result should be 10500

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!