Loops |
Create a client program
with a main method that performs the
following tasks modelled on the RandomDemo program (with similar white space, comments, formatted output, your name at the top of the output, etc.) You must use loops efficiently for all exercises since your code will be partially graded on efficiency. Your loops must have a blank
line above the first line of the loop and
below the last line
of the
loop
as is
required
by our Coding
Standards. Each of the following parts of output must be separated
by a blank line and labeled A through H as in A. Display the even integers from 2 to 20 inclusive on the same line of output but separated by single spaces. B. Display all multiples of 4 from 24 to 4 inclusive in descending order on the same line of output separated by tabs. C. Display the sum of the integers from 1 to 1000000 (inclusive). D. Display the exact average of the integers from 1 to 1000001 (inclusive) E. Display 5 pseudorandom integers between 1 & 100 inclusive separated by spaces on one line of output. Multiple occurrences of integers may occur. F. Display 10 pseudorandom integers between 1 and 20 inclusive separated by spaces on one line of output. Multiple occurrences of integers may occur. Determine whether or not the number 10 was one of the generated values. If 10 is one of the values, display either the message "10 was found" or "10 was not found" on the next line of output. G. Display 20 pseudorandom integers between or including -50 and 50 separated by spaces on one line of output. Multiple occurrences of integers may occur. On the next line of output, display a message indicating which displayed value is the greatest. H. Display 5 pseudorandom prime integers from the range 2 to 499 inclusive separated by spaces on one line of output. Multiple occurrences of integers may occur. If you have trouble with the algorithms above, you may want to review the Visual Basic lecture notes on If Statements to review how to find prime numbers and teh VB notes on Search Algorithms. Your program must follow the class Coding Standards. Preconditions:
You must hand in the following on separate pages stapled in this
specified order:
|