Results 1 to 4 of 4
Thread: What's wrong in my program...?
- 10-30-2008, 08:30 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 3
- Rep Power
- 0
What's wrong in my program...?
I can compile it but when the application is open, it says Error!!
/*
Chapter 3 Debugging Assignment
Programmer:
Date:
Program Name: Bert.java
Purpose:
*/
import java.io.*;
public class Bert
{
public static void main(String[] args) throws IOException
{
//Declaring Variables
String custName, inputPrice, inputDownPayment, inputTradeIn, inputMonths, inputAnnualInterest;
int price, downPayment, tradeIn, months, annualInterest;
double loanAmt,interest, payment;
BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));
//Get Input from User
System.out.print("What is your name? ");
custName = dataIn.readLine();
System.out.print("What is the price of the car? ");
inputPrice = dataIn.readLine();
price = Integer.parseInt(inputPrice);
System.out.print("What is the downpayment? ");
inputDownPayment = dataIn.readLine();
downPayment = Integer.parseInt(inputDownPayment);
System.out.print("What is the trade-in value? ");
inputTradeIn = dataIn.readLine();
tradeIn = Integer.parseInt(inputTradeIn);
System.out.print("For how many months is the loan? ");
inputMonths = dataIn.readLine();
months = Integer.parseInt(inputMonths);
System.out.print("What is the decimal interest rate? ");
inputAnnualInterest = dataIn.readLine();
annualInterest = Integer.parseInt(inputAnnualInterest);
//Calculations
interest = annualInterest / 12;
loanAmt = price-downPayment-tradeIn;
payment= loanAmt / ((1/interest)-(1/(interest * Math.pow(1+interest, months))));
//Output
System.out.println("The monthly payment for " + custName + " is $");
System.out.print(payment);
}
}
- 10-31-2008, 04:32 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 10-31-2008, 05:04 AM #3
i run same program its working fine.........no error here
what error r u getting??
- 10-31-2008, 06:03 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
So, what am I doing wrong?
By Charles_Smith in forum New To JavaReplies: 0Last Post: 10-29-2008, 02:50 PM -
Can someone tell me what I did wrong??
By booter4429 in forum New To JavaReplies: 7Last Post: 08-13-2008, 08:35 PM -
Simple Addition Program Outputting Wrong Value
By carlodelmundo in forum New To JavaReplies: 4Last Post: 08-05-2008, 03:37 AM -
what is wrong with this program ?
By Poor Bee in forum New To JavaReplies: 1Last Post: 05-07-2008, 07:23 PM -
I am Doing Something Wrong But Don't Know What?
By BHCluster in forum New To JavaReplies: 3Last Post: 04-16-2008, 01:16 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks