Wyo Java Ch6Proj1

Create a client program with a main method that performs the following tasks. You must efficiently use loops for all exercises since your code will be partially graded on efficiency. You may use a single-letter variable name such as i as your for loop control variable. 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. Document each loop as well to indicate which part of the assignment it corresponds to. Each of the following parts of ouput must be separated by a blank line and labeled a through h as in

A
2 4 6 8 etc

B
24 20 16 etc

C
etc.

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.

Your program must follow the class Coding Standards. Save all of the files associated with this assignment to a folder named Ch6Proj1 in the appropriate network folder.

Preconditions:

  • None
You must hand in the following on separate pages stapled in this specified order:
  1. The source code.
  2. The printscreen of your console window output.