Im reading Java for dummies lol and i got this example code.
import java.io.*;
import java.text.NumberFormat;
public class Mortgage
{
public static void main(String args[]) throws IOException
{
BufferedReader keyboard =
new BufferedReader(new InputStreamReader(System.in));
double principal, rate, ratePercent;
int years, n;
final int paymentsPerYear = 12;
final int timesPerYearCalculated = 12;
double effectiveAnnualRate;
double payment;
NumberFormat currency = NumberFormat.getCurrencyInstance();
System.out.println();
System.out.print("How much are you borrowing? ");
principal = Double.parseDouble(keyboard.readLine());
System.out.print("What's the interest rate? ");
ratePercent = Double.parseDouble(keyboard.readLine());
rate = ratePercent/100.00;
System.out.print("How many years are you taking to pay? ");
years = Integer.parseInt(keyboard.readLine());
System.out.println("--------------------...
n = paymentsPerYear * years;
effectiveAnnualRate = rate / paymentsPerYear;
payment = principal*(effectiveAnnualRate / (1 - Math.pow(1 effectiveAnnualRate, -n)));
System.out.print("Your monthly payment is ");
System.out.println(currency.format(payme...
System.out.println();
}
}
Then it says to Compile it. Did that. Then it says in the Command Prompt type
java Mortgage
When i do this, a bunch of errors come up saying a bunch of stuff and it doesnt work.
Has anyone had this happened before and fixed it. Please tell me how to fix it.
First Post to tell me right answer gets BEST ANSWER. Easy 10 Points.
Tags: