Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question: Let us calculate a given number like, 20. We calculate the expression

ID: 673561 • Letter: Q

Question

Question: Let us calculate a given number like, 20. We calculate the expression and output the result in each line. You should use a function named "calculate_rate" to calculate the given number n*(1+rate). Output the result of: sum0.02=20*(1+0.02)+10*(1+0.02)+...+1.25(1+0.02). Output the result of: sum0.04=20*(1+0.04)+10*(1+0.04)+...+1.25(1+0.04) ... Output the result of: sum0.1=20*(1+0.1)+10*(1+0.1)+...+1.25(1+0.1). Parameters must be used in this exercise.

Serious need of help. if you could please add comment so I can understand why you're doing what you're doing. The language of this exercise in Java. Thanks!!

Explanation / Answer

/* The logic is n is dividing by 2 in each iteration and in next number everytime rate is multiplying by 2 */

Public class CalculateExpression{

Public static void main (String[] args) {

float n=20, rate=0.02,sum=0;

public static float calculate_rate()

{ while(rate<=0.1)

for(i=n;i>=1.25;i/2)

{ sum= n*(1+rate);

n=n/2;

}

System.out.printl("Result is=" + sum)

rate= rate *2;

}

}}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote