[Solved] SOLVED: program that reads in a sequence of positive integers until a user enters -1 to quit

$25

File Name: SOLVED:_program_that_reads_in_a_sequence_of_positive_integers_until_a_user_enters_-1_to_quit.zip
File Size: 866.64 KB

SKU: [Solved] SOLVED: program that reads in a sequence of positive integers until a user enters -1 to quit Category: Tag:
5/5 - (1 vote)

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 dont 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.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED: program that reads in a sequence of positive integers until a user enters -1 to quit
$25