Java please helped 5.31 (Financial application: compute CD value) Suppose you pu
ID: 642183 • Letter: J
Question
Java please helped 5.31 (Financial application: compute CD value) Suppose you put $10,000 into a CD with an annual percentage yield of 5.75%. After one month, the CD is worth 10000 + 10000 * 5.75 / 1200 = 10047.92 After two months, the CD is worth 10047.91 + 10047.91 * 5.75 / 1200 = 10096.06 After three months, the CD is worth 10096.06 + 10096.06 * 5.75 / 1200 = 10144.44 and so on. Write a program that prompts the user to enter an amount (e.g., 10000), the annual percentage yield (e.g., 5.75), and the number of months (e.g., 18) and displays a table as shown in the sample run.Explanation / Answer
Required Solution:
import java.util.Scanner;
public class FinancialApplication
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
double amount,rate;
int months;
System.out.println("enter amount");
amount=sc.nextDouble();
System.out.println("enter rate ");
rate=sc.nextDouble();
System.out.println("enter months");
months=sc.nextInt();
for(int i=0;i<months;i++)
{
System.out.println("after "+(i+1)+" months cd worth");
System.out.print(amount+"+("+amount+"*"+rate+"/"+1200+")");
amount+= (amount *rate/1200);
System.out.println("="+amount);
}
}
}
Sample Output:
enter amount
10000
enter rate
5.75
enter months
18
after 1 months cd worth
10000.0+(10000.0*5.75/1200)=10047.916666666666
after 2 months cd worth
10047.916666666666+(10047.916666666666*5.75/1200)=10096.062934027777
after 3 months cd worth
10096.062934027777+(10096.062934027777*5.75/1200)=10144.439902253327
after 4 months cd worth
10144.439902253327+(10144.439902253327*5.75/1200)=10193.048676784958
after 5 months cd worth
10193.048676784958+(10193.048676784958*5.75/1200)=10241.890368361219
after 6 months cd worth
10241.890368361219+(10241.890368361219*5.75/1200)=10290.966093042949
after 7 months cd worth
10290.966093042949+(10290.966093042949*5.75/1200)=10340.27697223878
after 8 months cd worth
10340.27697223878+(10340.27697223878*5.75/1200)=10389.824132730757
after 9 months cd worth
10389.824132730757+(10389.824132730757*5.75/1200)=10439.608706700092
after 10 months cd worth
10439.608706700092+(10439.608706700092*5.75/1200)=10489.63183175303
after 11 months cd worth
10489.63183175303+(10489.63183175303*5.75/1200)=10539.894650946846
after 12 months cd worth
10539.894650946846+(10539.894650946846*5.75/1200)=10590.398312815967
after 13 months cd worth
10590.398312815967+(10590.398312815967*5.75/1200)=10641.14397139821
after 14 months cd worth
10641.14397139821+(10641.14397139821*5.75/1200)=10692.13278626116
after 15 months cd worth
10692.13278626116+(10692.13278626116*5.75/1200)=10743.365922528661
after 16 months cd worth
10743.365922528661+(10743.365922528661*5.75/1200)=10794.844550907444
after 17 months cd worth
10794.844550907444+(10794.844550907444*5.75/1200)=10846.569847713876
after 18 months cd worth
10846.569847713876+(10846.569847713876*5.75/1200)=10898.542994900838
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.