Exercise 15.5.6 Some credit card companies give you a refund at the end of the y
ID: 3630549 • Letter: E
Question
Exercise 15.5.6 Some credit card companies give you a refund at the end of the yeardepending on how much you’ve used the card. Imagine a company that pays back
• 0.25% of the first $500 you charge;
• 0.50% of the next $1000 you charge (i.e. anything you charge between $500 and
$1500);
• 0.75% of the next $1000 you charge (i.e. between $1500 and $2500);
• 1% of anything you charge over $2500.
For example, a customer who charged $400 would get back $1.00, which is 0.25% of $400.
A customer who charged $1400 would get back 0.25% of the first $500 (making $1.25), plus
0.50% of the next $900 (i.e. $4.50), for a total refund of $5.75.
Develop a function card-refund to determine how much refund will be paid to a
customer who has charged a specified amount on the card.
Explanation / Answer
Dear, Here is the code (define (bank-interest-rate amountUsed); amountUsed a number in dollarspay=0
(cond [(<amountUsed 500)+pay(*amountUseed .25)]
[and(<amountUsed 1500)
(>amountUsed 500) +pay(*amountUseed .50]
[and(<amountUsed 2500)
(>amountUsed 1500) +pay(*amountUseed .75]
[>amountUsed 2500) +pay(*amountUseed .1] Hope this will help you
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.