Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compile Problem

Status
Not open for further replies.

JavaNovice484

Programmer
Jul 29, 2006
2
0
0
US
Greetings,

I can't seem to compile my very small program....will someone please take a look to see where I've gone wrong, again I'm no programmer, simply a novice that's taken an intrest in different programming lanuages.

/*
Purpose: Calculates Monthly Car Payments
*/

import java.io.*;

public class Bert
{
public static void main(String[] args)
{
//Declaring Variables
int price, DownPayment, TradeIn, Months,loanAmt, interest;
int annualInterest, payment;
String custName, inputPrice,inputDownPayment,inputTradeIn,inputMonths, inputAnnualInterest;
BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));

//Get Input from User
System.out.println("What is your name? ");
custName = dataIn.readLine();
System.out.print("What is the price of the car? ");
inputPrice = dataIn.readLine();
System.out.print("What is the downpayment? ");
inputDownPayment = dataIn.readLine();
System.out.print("What is the trade-in value? ");
inputTradeIn = dataIn.readLine();
System.out.print("For how many months is the loan? ");
inputMonths = dataIn.readLine();
System.out.print("What is the decimal interest rate? ");
inputAnnualInterest = dataIn.readLine();

//Conversions
price = Integer.parseInt(inputPrice);
DownPayment = Integer.parseInt(inputDownPayment);
TradeIn = Integer.parseInt(inputTradeIn);
Months = Integer.parseInt(inputMonths);
annualInterest = Integer.parseInt(inputAnnualInterest);

//Calculations
interest = annualInterest/12;
loanAmt = price-DownPayment-TradeIn;
payment=loanAmt/((1/interest)-(1/(interest*Math.round(1+int Months))))));

//Output
System.out.print("The monthly payment for " + custName + " is $");
System.out.println(payment);
}
}
 
Please post your code with code tags.

What error are you getting?

Cheers,
Dian
 
Hi

I think the error is here :
Code:
payment=loanAmt/((1/interest)-(1/(interest*Math.round(1+[red]int[/red] Months))))
Just remove the [tt][red]int[/red][/tt] from there.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top