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

I need to write a Java program that computes simple and compounded interest usin

ID: 3638732 • Letter: I

Question

I need to write a Java program that computes simple and compounded interest using user input. I need the program to call a method.

This is what I have so far:

import java.util.Scanner;


public class Tester {

/**
* @param args
*/
public static void main (String[] args)
{
Scanner kb = new Scanner(System.in);
System.out.println("Enter investment amount: ");
float amount = kb.nextFloat();

System.out.println("Enter annual interest rate: ");
float rate = kb.nextFloat();

System.out.println("Enter number of years: ");
int years = kb.nextInt();

System.out.printf("Accumulated value using simple interest is $ %.2f ",
Project1.simpleInterest(amount, rate, years));

float value = Project1.compoundedInterest(amount, rate, years);
System.out.printf("Accumulated value using compounded interest is $ %.2f, years = %d ",
value, years);


}
}





/**
*
*
*/

public class Project1
{

/**
* Simple Interest Formula:
*
future value = investment amount x (1 + Interest rate * number Of years)

*@return
*/
public static float simpleInterest(float amount, float rate, int years)
{
return 0f;
}

/**
* *Compounded Interest Formula:
*
future value = investment amount x (1 + Interest Rate) ^ number Of Years
*

* @return
*/
public static float compoundedInterest(float amount, float rate, int years)
{
return 0f;
}







Explanation / Answer

please rate - thanks

import java.util.Scanner;


public class Tester {

/**
* @param args
*/
public static void main (String[] args)
{
Scanner kb = new Scanner(System.in);
System.out.print("Enter investment amount: ");
double amount = kb.nextFloat();

System.out.print("Enter annual interest rate: ");
double rate = kb.nextFloat();

System.out.print("Enter number of years: ");
int years = kb.nextInt();

System.out.printf("Accumulated value using simple interest is $ %.2f ",
Project1.simpleInterest(amount, rate, years));

double value = Project1.compoundedInterest(amount, rate, years);
System.out.printf("Accumulated value using compounded interest is $ %.2f ",
value);


}
}

--------------------------------


/**
*
*
*/

public class Project1
{


/**
* Simple Interest Formula:
*
future value = investment amount x (1 + Interest rate * number Of years)

*@return
*/
public static double simpleInterest(double amount, double rate, int years)
{double interest=amount*(1.+rate/100.*years);
return interest;
}

/**
* *Compounded Interest Formula:
*
future value = investment amount x (1 + Interest Rate) ^ number Of Years
*

* @return
*/
public static double compoundedInterest(double amount, double rate, int years)
{
double interest=amount*Math.pow(1.+rate/100. ,years);
return interest;
}

}