/* Chapter 3 Debugging Assignment Programmer: Nicolas Date: 18 February 2014 Program Name: bert.java Purpose: */ import java.util.Scanner; public class bert { public static void main(String[] args) { //Declaring Variables int price, downPayment, tradeIn, months; double annualInterest; String custName; Scanner reader = new Scanner (System.in); //Get Input from User System.out.println("What is your first name? "); custName = reader.next(); System.out.print("What is the price of the car? "); price = reader.nextInt(); System.out.print("What is the downpayment? "); downPayment = reader.nextInt(); System.out.print("What is the trade-in value? "); tradeIn = reader.nextInt(); System.out.print("For how many months is the loan? "); months = reader.nextInt(); System.out.print("What is the decimal interest rate? "); annualInterest = reader.nextDouble(); //Output calculatePayment (price, downPayment, tradeIn, annualInterest, months, custName); } public static void calculatePayment(int price, int downPayment, int tradeIn, double annualInterest, int months, String custName) { int interest; double loanAmt; double payment; //Calculations interest = (int)annualInterest / 12; loanAmt = price-downPayment-tradeIn; payment = ((1/interest)-(1/(interest*Math.pow(1+interest,months))))/loanAmt; System.out.print("The monthly payment for " + custName + " is $"); System.out.println(payment); } }
So far all I can gather is it is a problem with the equation and zero. Farther than that I am lost and I just can't seem to figure the rest out. It's the last error I need to fix.
Help is much appreciated.