Here is my code I have to debug for my computer programming class. I don't know what else to do! I have fixed a few, but probably 3 or 4 left. Thanks!
/*
Chapter 3 Debugging Assignment
Programmer:
Date:
Program Name: Bert,java
Purpose:
*/
import java.util.*;
public class bert
{
public static void main(String[] args)
{
//Declaring Variables
int price, downPayment, tradeIn, months;
double annualInterest, payment;
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);
}
public static void calculatePayment(int price, double downPayment, int tradeIn,
int months, double annualInterest)
{
int interest;
int loanAmt;
double payment;
int custName;
int downpayment;
//Calculations
interest = annualInterest / 12;
loanAmt = price-downpayment-tradeIn;
payment=loanAmt/((1/interest)-(1/(interest*Math.pow(1+interest months))));
System.out.print("The monthly payment for " + custName + " is $");
System.out.println(payment);
return;
}
}