Wow thanks Z.
That was really helpful, thanks to you I was able to make a solution and it wasn't so difficult after all.
/**
* Prints the sum of entered positive integers.
*/
public void sumValues()
{
int value;
int sum;
boolean negative = false;
System.out.println("#######################################");
System.out.println("You will be asked to enter a sequence");
System.out.println("of positive integers.");
System.out.println();
System.out.println("Enter as many as you like.");
System.out.println();
System.out.println("After your last number, enter a");
System.out.println("negative value.");
System.out.println();
System.out.println("Then the sum of your positive integers");
System.out.println("will be reported.");
System.out.println();
System.out.println("So, here goes...");
System.out.println("#######################################");
System.out.println();
System.out.print("- Enter a positive integer: ");
value = myReader.getInt();
sum = value;
do {
if(value > 0) {
System.out.print("- Enter another positive integer: ");
value = myReader.getInt();
sum += value;
} else {
sum -=value;
negative = true;
}
} while(negative == false);
System.out.println();
if(sum > 0) {
System.out.print("The sum of your integers is: ");
System.out.println(sum);
} else {
System.out.println("- Start with a positive integer.");
}
System.out.println();
System.out.println("Goodbye for now.");
}
Thanks!