Skip to content

Instantly share code, notes, and snippets.

@bitwiser
Created February 27, 2014 09:59
Show Gist options
  • Save bitwiser/9247324 to your computer and use it in GitHub Desktop.
Save bitwiser/9247324 to your computer and use it in GitHub Desktop.
import java.util.*;
import java.lang.*;
class test{
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int investment;
double interest,fv5,fv10,fv15,fv20;
System.out.print("Enter investment: ");
investment = s.nextInt();
System.out.print("Enter interest: ");
interest = s.nextDouble();
fv5 = investment*Math.pow((1+interest),5);
fv10 = investment*Math.pow((1+interest),10);
fv15 = investment*Math.pow((1+interest),15);
fv20 = investment*Math.pow((1+interest),20);
System.out.println("Future value for 5 yr: "+fv5);
System.out.println("Future value for 10 yr: "+fv10);
System.out.println("Future value for 15 yr: "+fv15);
System.out.println("Future value for 20 yr: "+fv20);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment