Using Scheme Code DrRacket Some credit-card companies pay back a small portion o
ID: 3855025 • Letter: U
Question
Using Scheme Code DrRacket
Some credit-card companies pay back a small portion of thecharges a customer makes over a year. One company returns
(a) 0.25% for the rst $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 is0.25% * 400, and one who charges $1,400 a year receives $5.75, whichis 1.25 = 0.25% * 500 for the rst $500 and 0.50% * 900 = 4.50 forthe next $900.
Dene the function payback, which consumes a charge amount andcomputes the corresponding pay-back amount.
Explanation / Answer
Its just simple java code having simple equations. public class PayBack { public static void main(String args[]) { float charge_amount=Float.parseFloat(args[0]); if(charge_amount500&&charge_amount1500&&charge_amount2500){ System.out.println("pay back amount is :"+((0.25f*0.01*500)+(0.50f*0.01*1000)+(0.75f*0.01*1000)+(1*0.01*charge_amount)));} } }Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.