Results 1 to 4 of 4
  1. #1
    Annatar is offline Member
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Question 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);
    }
    }

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by Annatar View Post
    I can compile it but when the application is open, it says Error!!
    What you mean by open? What error you get? Can you copy-paste your error message to see. Do you get any errors at run-time?

  3. #3
    jayant3001's Avatar
    jayant3001 is offline Member
    Join Date
    Oct 2008
    Posts
    22
    Rep Power
    0

    Default

    i run same program its working fine.........no error here
    what error r u getting??

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by jayant3001 View Post
    i run same program its working fine.........no error here
    what error r u getting??
    Are you pointing on me, I don't think so. I don't want to run and test the code lol. Our thread starter should explain the question much more clearly.

Similar Threads

  1. So, what am I doing wrong?
    By Charles_Smith in forum New To Java
    Replies: 0
    Last Post: 10-29-2008, 02:50 PM
  2. Can someone tell me what I did wrong??
    By booter4429 in forum New To Java
    Replies: 7
    Last Post: 08-13-2008, 08:35 PM
  3. Simple Addition Program Outputting Wrong Value
    By carlodelmundo in forum New To Java
    Replies: 4
    Last Post: 08-05-2008, 03:37 AM
  4. what is wrong with this program ?
    By Poor Bee in forum New To Java
    Replies: 1
    Last Post: 05-07-2008, 07:23 PM
  5. I am Doing Something Wrong But Don't Know What?
    By BHCluster in forum New To Java
    Replies: 3
    Last Post: 04-16-2008, 01:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •