Hey Lizard,
I have made a very slight edit to the code I helped you with previousally:
import java.util.Random;
import java.util.*;
public final class Sum10RandomIntegers {
public static final void main(String[] args) {
int sum = 0;
int randomInt;
int result = 0;
System.out.println("Generating 10 random integers in range 0 to 99.");
Random randomGenerator = new Random();
for (int random = 1; random <= 10; ++random) {
randomInt = randomGenerator.nextInt(10);
sum = (int) (Math.random() * 99);
if(sum < 50){
sum = -sum;
}
System.out.print(sum + " ");
result = result+sum;
}
System.out.println();
System.out.println("Result = " + result);
}
}
Example output:
Generating 10 random integers in range 0 to 99.
-49 86 -38 84 66 -18 95 -21 -15 -48
Result = 142