<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>The idea of embedding a program inside another is learned later in the book, check on local to see how it works, or don't worry about embedding until later on.<br><br>Simply define the function for now to just produce the amount of tax, 0, .15, or .28.<br><br>So the program should work like this<br>(equal? (tax 130)0)<br>(equal?(tax 250).15)<br>(equal?(tax 500).28)<br><br>get that working, then think about how you would solve this in one application. If you want to calculate net pay of some pay input, what would you do?<br><br>well, net pay is gross-pay - tax on gross pay.<br><br>How would you implement that for a gross pay input of 130, 250, and 500?<br><br>First, figure out what the net pay would be, then apply how you calculated that in scheme expressions.<br><br>This approach by you was
very close:<br><pre>(define (tax_pay pay)<br> (cond<br> [(<= pay 240) 0]<br> [(<= pay 480) (* pay 0.15)]<br> [(> pay 480) (* pay 0.28)]))<br><br>There are two problems I saw, you are treating pay as another function. Just treat it as some input<br>any random number will work.<br><br>The second problem, think about what you are calculating in each conditional clause.<br><br>This function is pretty close. You only really need one function to compute net pay.<br><br>if you wanted you can define another function called pay for simple testing<br>;;assuming 12 dollars an hour as a pay rate<br><br>(define(pay hours)<br>...hours .12..) <br><br>Then applying (tax_pay(pay 25))<br><br>Would produce net pay for some given hourly input.<br></pre><br></div>
</div><br>
</body></html>