justinboyle
03-09-2009, 12:36 PM
I'm writing a program for a project in my comp class that requires us to use while statements. I can make the program run straight forward, but the program needs to ask the user to enter valid "taxRate" and "itemPrice". My problem is that it will ask for a valid rate, and price, but after one or the other it will just end the program. Nothing will run after it asks for a valid number. this is what my code looks like for the while statement
if "itemPrice" < 0
While "itemPrice" < 0
"itemPrice" set value to (Ask user for number- Question: Please enter a valid price)
Else
"taxRate" set value to (Ask user for number - question : Enter tax rate on item)
Like I said before once it runs through the while statement for "itemPrice" it will just stop as if a do nothing is in under else.
Any help would be greatly appreciated
if "itemPrice" < 0
While "itemPrice" < 0
"itemPrice" set value to (Ask user for number- Question: Please enter a valid price)
Else
"taxRate" set value to (Ask user for number - question : Enter tax rate on item)
Like I said before once it runs through the while statement for "itemPrice" it will just stop as if a do nothing is in under else.
Any help would be greatly appreciated