# program that reads in a sequence of positive integers until a user enters -1 to quit

Write a program called Assignment4 (saved in a file Assignment4.java) that reads in a sequence of

positive integers until a user enters -1 to quit (we don't know how many numbers the user may enter) The loop continues to ask for user input until the user enters negative one:

Enter a positive integer. Enter -1 to quit.

For each positive integer, check if it is a prime number or not.

If it is prime then print out:

The number X is a prime number.

If it is not prime print out:

The number X is not a prime number.

Note that X is a positive number entered by the user

Once the user enters -1, then the program stops asking for more positive integers, and computes the

maximum and minimum among integers entered by the user, and the sum, the count, and the average

of these integers. These computations DO NOT include -1 -- the last read number.

(note that max, min, sum, and count will be computed through iterations of a loop, see the example

Average.java in your book)

Your average should be formatted with two digits to the right of the decimal point.

positive integers until a user enters -1 to quit (we don't know how many numbers the user may enter) The loop continues to ask for user input until the user enters negative one:

Enter a positive integer. Enter -1 to quit.

For each positive integer, check if it is a prime number or not.

If it is prime then print out:

The number X is a prime number.

If it is not prime print out:

The number X is not a prime number.

Note that X is a positive number entered by the user

Once the user enters -1, then the program stops asking for more positive integers, and computes the

maximum and minimum among integers entered by the user, and the sum, the count, and the average

of these integers. These computations DO NOT include -1 -- the last read number.

(note that max, min, sum, and count will be computed through iterations of a loop, see the example

Average.java in your book)

Your average should be formatted with two digits to the right of the decimal point.

You'll get 1 file (3.4KB)