Question: Write a Java program which asks the user to enter a positive integer n and then reads in the user's input. Assume the user's input
Write a Java program which asks the user to enter a positive integer n and then reads in the user's input. Assume the user's input is valid. The program then asks the user to enter a list of n integers. After the user enters n integers, the program then outputs to the console how many values in the list are strictly greater than the last value in the list. Here are two sample runs (user input is in bold):
Enter positive integer n: 8 Now enter a list of 8 integers: 44 11 77 222 -99 33 77 20 Number of list values larger than the last list value: 5
-------------------------------------------------------------------------------------------
Enter positive integer n: 5 Now enter a list of 5 integers: 17 0 66 29 66 Number of list values larger than the last list value: 0
-------------------------------------------------------------------------------------------
public static void main(String [] args) {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
