Search:

Type: Posts; User: aussiemcgr

Search: Search took 0.08 seconds.

  1. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    The code works perfectly for me, both in my IDE and in the command line. My guess is Netbeans has either cached your old file and is running that, or your old file still exists somewhere and it is...
  2. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    Um, I suppose you could close Netbeans, try to find the .class file Netbeans created and delete it in your file system, start up Netbeans again, recompile your file, and attempt to run it again.
  3. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    Ok, assuming that your MortgageCalculation2a class is in the mortgagecalculation2a package, do the following:

    Locate the MortgageCalculation2a.java class in your file system (assuming windows...
  4. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    Ok, then netbeans must be the problem.
    Do you know how to compile and run from the command prompt?
  5. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    No, I said the new code could not possibly create what you posted in the screen shot of your output.
    Simply looking at the code, there is no possible way "ALL NUMERICAL VALUES MUST BE POSITIVE!" can...
  6. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    There is nothing wrong with that code. I just ran it on my computer and got the following result:


    And then I ran it with positive values:
  7. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    That code cannot create the output you posted in your picture.
    I suggest you make sure your file is saved and run it again.
  8. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    Can you post your entire code?
  9. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    It does the calculation because you are doing the calculation outside of the else block.
    If you do not want the calculation to occur and you don't want the "The monthly payment is" statement to...
  10. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    Ok, that is a step in the correct direction. However, you want this print statement: System.out.println("ALL NUMERICAL VALUES MUST BE POSITIVE!"); in all the if blocks for a value being less than 0....
  11. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    Ok. For your reasons, you don't need an else if statement or block.
    You have two conditions:
    1. loanAmount is less than 0
    2. loanAmount is not less than 0
    So, you need an if statement, and then...
  12. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    Ok, that is incorrect.
    You have System.out.println("ALL NUMERICAL VALUES MUST BE POSITIVE!"); in your else block, not your if block.
    "if (monthlyPayment = interestRate * loanAmount *...
  13. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    You would put EVERYTHING that you don't want to execute if loanAmount was less than 0. As for the other variables, keep in mind that you can put multiple conditions in an if statement with the use of...
  14. Replies
    37
    Views
    2,738

    Re: If Then Statement Question!

    Given your current design, I believe KevinWorkman was attempting to hint you towards the else statement.
    You have an if block for: "if loanAmount is less than 0". In this block, you have the print...
Results 1 to 14 of 14