<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello, <br>
<br>
I try to make this exercise :<br>
<br>
<title>How to Design Programs: An Introduction to Computing and
Programming</title>
<p> Some credit card companies pay back a small portion of the
charges a customer makes over a year. One company returns</p>
<ol>
<li>
<p>.25% for the first $500 of charges, </p>
</li>
<li>
<p>.50% for the next $1000 (that is, the portion between $500
and $1500),</p>
</li>
<li>
<p>.75% for the next $1000 (that is, the portion between $1500
and $2500), </p>
</li>
<li>
<p>and 1.0% for everything above $2500.</p>
</li>
</ol>
<p>Thus, a customer who charges $400 a year receives $1.00, which is
0.25 · 1/100 · 400, and one who charges $1,400 a year receives
$5.75, which is 1.25 = 0.25 · 1/100 · 500 for the first $500 and
0.50 · 1/100 · 900 = 4.50 for the next $900.</p>
<p>Determine by hand the pay-backs for a customer who charged $2000
and one who charged $2600.</p>
<p>Define the function <code class="scheme"><span class="variable">pay-back</span></code>,
which consumes a charge amount and computes the corresponding
pay-back amount</p>
<link title="default" rel="stylesheet" type="text/css"
href="curriculum-Z-S.css">
So I made this : <br>
<br>
(define (tarief4 amount)<br>
(cond <br>
[ ( < amount 2500)(- (* .00100 amount)2500)]<br>
[ else ( - ( * .0100 1000) 2500)]))<br>
<br>
<br>
(define (tarief3 amount)<br>
(cond <br>
[ ( < amount 2500)(- (* .0075 amount)1500)]<br>
[ else ( - ( * .0075 1000) 1500)]))<br>
<br>
(define (tarief2 amount)<br>
(cond <br>
[ ( < amount 1500)(- (* .0050 amount)500)]<br>
[ else ( - ( * .0050 1000) 500)]))<br>
<br>
<br>
(define (tarief1 amount)<br>
(cond <br>
[ (< amount 500) (* 0.025 amount)]<br>
[ else (* 0.025 500)]<br>
))<br>
<br>
<br>
(define (payback amount)<br>
(cond <br>
[ (<= amount 500) ((tarief1 amount))]<br>
[ (and ( <= amount 1500) (> amount 500)) (+ (tarief1
amount)(tarief2 amount))]<br>
[ (and ( <= amount 2500) (> amount 1500)) (+ (tarief3
amount) (tarief2 amount))]<br>
[ else (+ (tarief4 amount)(tarief3 amount))]<br>
))<br>
<br>
<br>
But now I get this error message : <br>
unsaved editor>:27:23: function call: expected a function after
the open parenthesis, but found a part in: (tarief1 amount)<br>
<br>
When I do (tarief 1 amount) instead of ((tarief amount)) I don't get
the error message but the outcome of (payback 2600) is not right. <br>
<br>
Anyone a tip for me ?<br>
<br>
Roelof<br>
<br>
<br>
<br>
<br>
</body>
</html>