Search:

Type: Posts; User: Norm

Search: Search took 0.20 seconds.

  1. [SOLVED] Re: Need some helping finding the lowest, highest, sum, and average.

    What is the starting value in lowest? Are there any random numbers that will be less than its initial value?
    Try a different starting value.
  2. [SOLVED] Re: Need some helping finding the lowest, highest, sum, and average.

    Use an if statement to compare and when true save the value.

    See the tutorial on if statements: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html
  3. [SOLVED] Re: Need some helping finding the lowest, highest, sum, and average.

    Ok, try lowest. Use a variable to hold the lowest value found so far. Compare each new number against it and save if lower.

    You also could have done the average once you have the sum.
  4. [SOLVED] Re: Need some helping finding the lowest, highest, sum, and average.

    Define a variable outside of the loop (same as r) and inside the loop add each random number to it.
    You would not need a new loop. I was assuming the random numbers were to be saved in an array but...
  5. [SOLVED] Re: Need some helping finding the lowest, highest, sum, and average.

    Ok work on one of those at a time.
    I think the easiest would be the sum. See if you can write a loop to sum the values.
    Then the average would be the sum divided by the count.
Results 1 to 5 of 5