5. The partially written program fragment is intended to read a number of intege
ID: 3753636 • Letter: 5
Question
5. The partially written program fragment is intended to read a number of integer values (in range l0, 1 of values is given by the named constant HoW_MANY. Complete the program fragment so that it: a) reads 8 input values b) determines the largest of those values, c) counts how many input values were even (divisible by 2) d) displays the two values from (b) and (c). Example: If the values are (49, 76, 55, 36, 51, 91, 71, 78), it should output 91 and 3. Complete the program fragment. not declare any more variables, but complete any missing parts in declaration(s). Also, all necessary input and outp statements are already given (including prompts). Scanner cin new Scanner(System ip); final int HOW MANY while (CVHOW_MANY) ( System.out.print("Enter an integer: "); val-cin nextInt count++ Lcv++i // end loop System.out.println(max); System.out.printin(count);Explanation / Answer
Scanner cin = new Scanner(System.in); final int HOW_MANY = 8; int Lcv = 1, count = 0, val, max = 0; while(Lcv max) max = val; Lcv++; } //end loop System.out.println(max); System.out.println(count);Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.