Question: JAVA problem create a class Menu that implements the following methods: 1.public static int findRange(int[] array) which takes in an an array of integers as

JAVA problem

create a class Menu that implements the following methods:

1.public static int findRange(int[] array) which takes in an an array of integers as the input and returns range of the values i.e. the difference between the maximum and the minimum values 2.public static int getMax(int[] array) which takes in an array of integers as the input and returns the highest value as the output 2.public static int getSecondHighest(int[] array) which takes in an array of integers as the input and returns the second highest value as the output

On startup, your program should prompt the user by providing the following menu:

Please enter: 1 to find range of the scores 2 to find the maximum score 3 to find the second highest score

After receiving the user's choice of operation, the program reads an integer N (size of the array) followed by the N elements of the array itself in as many lines. These are then fed to the appropriate method which produces the desired result. However, if the user's choice was invalid in the first place then print "Invalid Option Selected" instead of taking in an array

Sample Input 1 Sample Output 1 1 2 3 1 2 3

Sample Input 2 Sample Output 2 2 3 3 1 2 3

Sample Input 3 Sample Output 3 4 "Invalid Option Selected"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!