You need to think more clearly about what you want to take place when the user enters a negative value. I suspect that what you are after would look something like this:
Enter today's sales for store 1: -40
Error - Please enter a positive value
Enter today's sales for store 1: 50
Enter today's sales for store 2: 30
..... and so on
As an outline, the process might look like this:
1 2 3 4 5 6 7 8 9
|
I. Get values
A. For each store
1. Get sales
2. If sales is negative, report error
3. Repeat until sales is not negative
II. Show graph
A. Output title
B. For each store
1. Output "bar"
|
Whenever a process involves repeating a step, you're looking at a loop,
and you have three choices: for, while, or do. I'll let you look into those to determine which one will work best in this case. There's also a sophisticated change you could make in the for loop, but I don't recommend it.
As long as you are error checking, ask yourself why you are checking for negative values. Is there any other input that can cause undesired results? How should those be handled? Is forcing the user to reenter invalid data the only option?