CSE 461: Programming Languages Concepts Prof. G. Tan Spring 2022 Homework 4: Racket warming up Due on Mar 6th at 6pm in Canvas. Submission: you should submit via Canvas a DrRacket file with Racket...

1 answer below »
Racket programming


CSE 461: Programming Languages Concepts Prof. G. Tan Spring 2022 Homework 4: Racket warming up Due on Mar 6th at 6pm in Canvas. Submission: you should submit via Canvas a DrRacket file with Racket code in. Please clearly mark your answers using comments so that we can tell the correspondence between your code and questions. 1. (0 points) Go through a brief tutorial about the DrRacket program- ming environment at http://docs.racket-lang.org/drracket/index. html. 2. (3 points) sum(start, end) computes the sum from start to end; e.g., sum(3, 6) computes 3+4+5+6, which is 18. It can be defined recur- sively in the following way. Define the corresponding Racket function, following the definition below. sum(start, end) = { start if start = end sum(start, end− 1) + end otherwise 3. (3 points) Write the Hofstadter functions in Racket. Hofstadter Female and Male functions are a pair of mutually recursive functions defined as follows: F (0) = 1 M(0) = 0 F (n) = n−M(F (n− 1)),when n > 0 M(n) = n− F (M(n− 1)),when n > 0 4. (3 points) A cash reward credit card rewards back to a customer a portion of the charges the customer makes over a month. One such credit card rewards back (a) 1% for the first $2000 of charges, (b) 1.5% for the next $2000 (that is, the portion between $2000 and $4000), 1 http://docs.racket-lang.org/drracket/index.html http://docs.racket-lang.org/drracket/index.html (c) 2% for the next $1500 (that is, the portion between $4000 and $5500), (d) and 2.5% for everything above $5500. Define the function reward, which consumes a charge amount and computes the corresponding reward amount. 2
Answered 1 days AfterMar 03, 2022

Answer To: CSE 461: Programming Languages Concepts Prof. G. Tan Spring 2022 Homework 4: Racket warming up Due...

Arun Shankar answered on Mar 05 2022
94 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here