Please answer these questions using Scheme code:
Some credit-card companies pay back a small portion of the charges a customer makes over a year.
One company returns
(a) 0.25% for the first $500 of charges,
(b) 0.50% for the next $1000 (that is, the portion between $500 and $1500),
(c) 0.75% for the next $1000 (that is, the portion between $1500 and $2500),
(d) and 1.0% for everything above $2500.
Thus, a customer who charges $400 a year receives $1.00, which is 0.25% * 400, and one who charges $1,400 a year receives $5.75, which is 1.25 = 0.25% * 500 for the first $500 and 0.50% * 900 = 4.50 for the next $900. Define the function payback, which consumes a charge amount and computes the corresponding pay-back amount.
Code the Ackermann function in DrRacket, which is defined as follows: A(m, n) = n + 1 if m = 0, A(m - 1, 1) if m > 0 and n = 0 A(m - 1, A(m, n - 1)) if m > 0 and n > 0
To check your result, use DrRacket to compute the result of A(3, 4), which should be 125.
John McCarthy is a famous computer scientist who designed LISP. He once proposed a function called the McCarthy 91 function, defined as follows: Mac(n) = ( n - 10 if n > 100 Mac(Mac(n + 11)) if n = 100
Write this function in Scheme. Try calling the function with a few numbers less than 100 and see what the results are.
Write a higher-order function mult n that takes an integer n as a parameter and returns a function, which multiples its parameter by n.
Thus, ((mult n 3) 2) = 6 and ((mult n -2) 3) = -6.