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

Can you please help me check my error? ackage assignment4; import java.text.Deci

ID: 3598447 • Letter: C

Question

Can you please help me check my error?

ackage assignment4;

import java.text.DecimalFormat;

import java.util.Scanner;

/**

*

* @author User01

*/

public class Assignment4 {

    /**

     * @param args the command line arguments

     */

    public static void main(String[] args) {

        // TODO code application logic here

        Scanner input = new Scanner(System.in);

        DecimalFormat df = new DecimalFormat("0.00");

        

   

        System.out.print("Enter the initial deposit amount: ");

        double Deposit = input.nextDouble();

        System.out.print(" Enter annual percentage yield:") ;

        double Percentage = input.nextDouble();

        System.out.print("Enter maturity period (number of months):");

        double Period = input.nextDouble();

        

        System.out.println("Month" + " "+ " "+ "CD Value");

        for (int i = 1; i <= Period; i++){

            double value=(Deposit+Deposit*Percentage/1200)*(i);

            

            

        System.out.println(i+ " "+" "+df.format(value));

            

            

        }

        

        

    }

    

}

  
  
}
  
  
}
  
}

Problem Statement 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.9210047.92 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 java program that prompts the user to enter an amount (e.g., 10000), the annual percentage vield (e.g., 5.75), and the number of months (e.g.. 18) and displays a table as presented in the sample run. Enter the initial deposit amount: 10000 Enter annual percentage yield: 5.75 Enter maturity period (number of months): 18 CD Value 10047.92 10096.06 Month 2 17 18 10846.57 10896.54

Explanation / Answer

Assignment4.java

package a10;


import java.text.DecimalFormat;
import java.util.Scanner;

/**
*
* @author User01
*/
public class Assignment4 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner(System.in);
DecimalFormat df = new DecimalFormat("0.00");
  

System.out.print("Enter the initial deposit amount: ");
double Deposit = input.nextDouble();
System.out.print(" Enter annual percentage yield:") ;
double Percentage = input.nextDouble();
System.out.print("Enter maturity period (number of months):");  
double Period = input.nextDouble();
double value = Deposit;
System.out.println("Month" + " "+ " "+ "CD Value");
for (int i = 1; i <= Period; i++){
value= value + (Deposit*Percentage)/1200;
  
  
System.out.println(i+ " "+" "+df.format(value));
  
  
}
  
  
}
  
}

Output:

Enter the initial deposit amount: 10000

Enter annual percentage yield:5.75

Enter maturity period (number of months):18

Month CD Value

1 10047.92

2 10095.83

3 10143.75

4 10191.67

5 10239.58

6 10287.50

7 10335.42

8 10383.33

9 10431.25

10 10479.17

11 10527.08

12 10575.00

13 10622.92

14 10670.83

15 10718.75

16 10766.67

17 10814.58

18 10862.50