Okay, I am a new student (to Java--well programming in general) and the first assignment we have is to create a program that computes the future value of an investment based on three user inputs (principle deposit, interest rate, and length of term in years).
First of all, I am at a loss as how to assign variable that are not constant. Principle, rate, and term are set to whatever the user decides to input when prompted. But that is the least of my problems. I just keep getting error code after error code when building the file.
I am not asking anyone to tell me what the solution to my problems are, as I want to do my own work... but I would like help with walking me through the process of debugging the program.. maybe through examples that are similar or something. I am aware that programming is the easy part, its the debugging that is challenging.
Here is my program...
/**
* HW02_jsn.java
* Jacqualyn Nelson
* 2009/1/16
*
* Calculate the future value of an investment paying compound interest annually
*/
import java.util.Scanner;
public class HW02_jsn
{
Scanner input = new Scanner(System.in);
public static void main(String[] args)
{
// call splash()
// input principle, rate, years
// display calcFV (principle, rate, years)
System.out.println("What was the amount of the principle deposit? ");
double profit = scan.nextDouble();
System.out.println("What is the annual interest rate? ");
double rate = scan.nextDouble();
System.out.println("What is the term of the investment in years? ");
int years = input.nextInt();
}
public static void splash()
{
System.out.println("This program calculates an approximation of the future value of an investment based on these three variables:");
System.out.println("The amount of the principle deposit");
System.out.println("The amount of the annual interest rate");
System.out.println("The term of the investment in years");
}
public static double calcFV(double p, double r, int t)
{
double value1 = p; // assign the variable p to principle
double value2 = r; // assign the variable r to rate
int value3 = t; // assign the variable t to years
int calcFV(double p, double r, int t)
{
int fv = p * Math.pow( (1.0 + r/100), t);
return fv;
}
System.out.println("Your investment will be worth approximately: " + calcFV(p, r, t) );
}
} // end HW02_jsn
I very much appreciate any and all feedback!