Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. Construct a JavaConsole Program that reads in a list of integers, one per line, until a sentinel value of 0 (which you should be
3. Construct a JavaConsole Program that reads in a list of integers, one per line, until a sentinel value of 0 (which you should be able to change easily to some other value). When the sentinel is read, your program should be able to display the largest and the smallest number in your console. Your code can also find the prime numbers. Print the number of prime numbers and display the total of prime numbers as well as illustrated in this sample run given below. Note: You are NOT allowed to use Math class methods or Arrays class. You MUST use any appropriate control statement. Your code must make sure the user key in minimum 2 integers to process if not request them to key in again. If the user enters the sentinel on the very first input line, then no values have been entered, and your program should display a message to that effect. Your output shall look like this: This program will acquire integer inputs and display the largest and smallest numbers and the number and summation of prime numbers. Type 0 to finish. ?23 ? 67 202 ? 45 ?16 20 Number of input values 5 Largest number 67 Smallest number 2 Number of prime number (5) = 2 Total of prime number (s) 90 = = = = (10 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started