wait ok i think i have solved it. i used some while boolean valid thing. seems to work.
Is there anyway i can handle negative numbers as errors. cos say i dont want the user to be able to enter a negative number. An error message should appear. Is there anyway??