Lab #7 - Task 4

Stephan Knotek

Task 4 - while Loop

  1. Designate a variable called counter and assign the numeric value 1 to it.
  2. Then create a while loop where the counter variable is equal to or less than 10
  3. Create a new variable called "tax" and set it to the following: tax = 0.055 * counter variable
  4. Display "Tax for (counter variable) dollar(s) is (counter variable) x 0.055 = tax variable"
  5. Use the number_format($var, 2) function to round the number to the nearest two decimal places

(Hint: Be sure to wrap the line you are displaying in paragraph tags, or use a line break or horizontal rule at the end of each line or everything will run together.)

Tax for 1 dollar(s) is 1 x 0.055 = 0.06.

Tax for 2 dollar(s) is 2 x 0.055 = 0.11.

Tax for 3 dollar(s) is 3 x 0.055 = 0.17.

Tax for 4 dollar(s) is 4 x 0.055 = 0.22.

Tax for 5 dollar(s) is 5 x 0.055 = 0.28.

Tax for 6 dollar(s) is 6 x 0.055 = 0.33.

Tax for 7 dollar(s) is 7 x 0.055 = 0.39.

Tax for 8 dollar(s) is 8 x 0.055 = 0.44.

Tax for 9 dollar(s) is 9 x 0.055 = 0.50.

Tax for 10 dollar(s) is 10 x 0.055 = 0.55.

*Programmer's note: there appears to be no instructed termination of the loop. The $counter never changes with the listed instructions, so it has been modified to increment $counter