Write a program that prompts the user to enter an amount the

Write a program that prompts the user to enter an amount, the annual interest rate, and the number of months then displays the balance after the given month.

20 2.L 15 16 17 18 19 22 23 24 25 26 27 28 29 30 31 (Financial application: compound value) Suppose you save $100 each month into a savings account with the annual interest rate 5%. So, the monthly interest rte is 0.05 / 12 = 0.00417. After the first month, the value in the account becomes 5.30 100 * (1 + 0.00417) = 100.417 After the second month, the value in the account becomes (100 100.417) (1 0.00417) 201.252 After the third month, the value in the account becomes (100+ 201,252) (1 0.00417) 302.507 and so cn Write a progruas that proakots àe eser to enter an amount (e.g., 100), the annual interest rate (e.g., \"), and tne wimber of months (e.g., 6) and displays the amount in the savings account after the given month. (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 I

Solution

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


/* Name of the class has to be \"Main\" only if the class is public. */
class deep
{
   public static void main (String[] args) throws java.lang.Exception
   {
  
   DecimalFormat df = new DecimalFormat(\"#.###\");
   Scanner input=new Scanner(System.in);
   System.out.println(\"enter months saving\");
   int save=input.nextInt();
   System.out.println(\"enter the interest of month\");
   Double inter=input.nextDouble();
   System.out.println(\"enter the number of months \");
   Double month=input.nextDouble();
   Double tsaving=(save*month);
   Double tinter=(inter/12)*month;
   Double totalamount=tinter+tsaving;
  
   System.out.println(\"the total amount \"+ df.format(totalamount));
       // your code goes here
   }
}

Write a program that prompts the user to enter an amount, the annual interest rate, and the number of months then displays the balance after the given month. 20

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site