Search:

Type: Posts; User: Norm

Search: Search took 0.16 seconds.

  1. Re: How i can solve this question? help me please ...

    Does it execute the way you want?

    One suggestion: Use the Math class's PI variable for a more accurate value for pi.
  2. Re: How i can solve this question? help me please ...

    You should always enclose code in if statements and loops in {}. Your code has left off the {} to enclose the code in the if statement.
  3. Re: How i can solve this question? help me please ...

    Put it at the place in the code where you want the program to stop executing.
  4. Re: How i can solve this question? help me please ...

    See post #12
  5. Re: How i can solve this question? help me please ...

    Check your keyboard. A zero(0) is different from the letter(o)
  6. Re: How i can solve this question? help me please ...

    Why are you comparing the value of the variable r to the variable: o?
  7. Re: How i can solve this question? help me please ...

    Define the variable o in class a so it can be used on line 21.

    What code is on line 21?
  8. Re: How i can solve this question? help me please ...

    What does the console look like when you execute the program? Please copy and paste it here.

    Can you explain what the problem is with the way the program is executing?
  9. Re: How i can solve this question? help me please ...

    Did you understand what I wrote about the order that statements in a program are executed?

    What will be the value of r when your if statement testing its value is executed?

    What happens when...
  10. Re: How i can solve this question? help me please ...

    You need to understand that the statements in the program are executed in the same order as they are entered in the source. The first state is executed first, then the next one and then the next one....
  11. Re: How i can solve this question? help me please ...

    Add code to test if r is negative and exit the program is it is.
  12. Re: How i can solve this question? help me please ...

    I've been trying to tell you what variable to test. I've asked you to find it and test its value.
    The code inside the loop has these varibles: a,i,p,r
    Which one of those is what the user has...
  13. Re: How i can solve this question? help me please ...

    Can you explain what the problem is? The code in post#21 shows you can write code to get input from a user.
    Where in the code in post #13 do you get input from a user? What variable is the input...
  14. Re: How i can solve this question? help me please ...

    Work on understanding what needs to be done to read input from a user.
    Write a small simple program that
    asks a user to enter a number,
    reads that number
    and prints out the number that the user...
  15. Re: How i can solve this question? help me please ...

    The mistake is the code is looking at the loop control variable and not at the variable where the input is read from the user.

    Where does the code read input from the user?
  16. Re: How i can solve this question? help me please ...

    Where does the user enter the input into the program? Where is it read into a variable?
    The variable i is the for loop control variable. i starts at 0 and increases to 9. It will never be less...
  17. Re: How i can solve this question? help me please ...

    Where do you test the value that the user entered?
  18. Re: How i can solve this question? help me please ...

    Use an if statement to test if the number that was input by the user is a negative number. If it is you can use the System.exit(0); statement to stop the program.

    What happens with your code if...
  19. Re: How i can solve this question? help me please ...

    You need to look at how to code a for loop:
    The for Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)

    Look especially at the termination expression.
  20. Re: How i can solve this question? help me please ...

    Sorry, we don't do student homework. If we did, we should get the credit for the work not you.
    If you have questions or problems, post them with the code you are having problems with.
  21. Re: How i can solve this question? help me please ...

    One problem at a time.

    Look at how to use the Scanner class to read in a number from the user from (System.in).
    The nextInt method would be used there.

    When you get the code to work with one...
  22. Re: How i can solve this question? help me please ...

    Are you trying to learn how to write programs in java?
    What have you learned so far? Can you use an of what you have learned to start solving this problem?

    Post your current code and ask some...
  23. Re: How i can solve this question? help me please ...

    Do you have any specific java programming questions?
    What problems are you having?
Results 1 to 23 of 23