Assignment F

For each problem:

Problem F1

Write a do while loop to require the user to enter two integers; the second integer must be equal to, or larger than, the first integer. Both integers must be at least 1 and not larger than 20. If they do not enter correct integers, give them error messages and make them do it again until they are correct.

After the acceptable integers have been entered, use a for loop to print a table of integers and their square roots for all integers from the first integer specified by the user to the last integer specified by the user, inclusive. Align the table and print 4 decimal positions

A sample table follows, for integers 7 to 9:

INTEGER  SQUARE ROOT
      7       2.6458
      8       2.8284
      9       3.0000
  

Test the program twice:
First test, first enter: first integer = 2, second integer = 0
and after that is rejected: first integer = 2, second integer = 4

Second test, first enter: first integer = 21, second integer = 5
and after that is rejected: first integer = 5, second integer = 5

Problem F2 = Chapter 5 Programming Challenge 6

Make the speed and the time both integers.
Test data, run the program twice:
First test, speed -2 and time -1; when that is rejected, speed -1 and time 0; when that is rejected, speed 0 and time 1.
Second test speed 20, time 5