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

    Question what's wrong in here!!!

    It compiles, but it does not run correctly :mad:

    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
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    It compiles, but it does not run correctly
    A great resource that has helped me and will probably help you is an article entitled How To Ask Questions The Smart Way. It will tell you how to formulate your questions so that the folks here will be better able to answer them.

    For instance, it will go into detail on how the better the information you give about your problem, the better the chances of your getting a decent answer. Please elaborate further on "does not run correctly" and tell us as best you can what it's doing that it shouldn't be doing and what it's not doing that it should be doing. Also, what have you done to try to debug things? Have you placed System.out.println's in your code to test the state of different variables?

    Good luck.

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

    Default

    Quote Originally Posted by Annatar View Post
    It compiles, but it does not run correctly :mad:

    First, you should ask your question much clearly. I think no one wants to run your code and find issues and fix them.

    Second, do not post the same question again and again. I already found that you have post this question in another thread.

  4. #4
    presh4u Guest

    Default

    see whether the tags are closed correctly and the case sensitive

  5. #5
    Annatar is offline Member
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Default

    no sabes...

  6. #6
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    7

    Default

    Seriously, if you want help, you have to at least tell us what the output should be and what it is, and if you're nice enough, the portion of code it involves and why it seems to be going wrong.

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Creo que no vale la pena.

  8. #8
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default Great Spanish...

    Fubarable... either that's the title of a song or you speak Spanish... which?

    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    I speak a little Spanish. It's my attempt at saying that I believe that this thread may not be worth the effort.

Similar Threads

  1. So, what am I doing wrong?
    By Charles_Smith in forum New To Java
    Replies: 0
    Last Post: 10-29-2008, 03:50 PM
  2. right or wrong
    By jot321 in forum New To Java
    Replies: 7
    Last Post: 09-25-2008, 12:45 PM
  3. What's wrong with my codes?
    By ayoood in forum New To Java
    Replies: 16
    Last Post: 09-01-2008, 04:57 AM
  4. Can someone tell me what I did wrong??
    By booter4429 in forum New To Java
    Replies: 7
    Last Post: 08-13-2008, 09:35 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, 02: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
  •