Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA Lab 1 3 A: Write the three static methods below inside of your driver class ( this is the class that contains your main
JAVA
LabA: Write the three static methods below inside of your driver class this is the class that contains your main method:
min: Receives an integer array as a parameter and returns an integer. This method traverses the array in the parameters and returns the smallest number in the array.
max: Receives an integer array as a parameter and returns an integer. This method traverses the array in the parameters and returns the largest number in the array.
avg: Receives an integer array as a parameter and returns a double. This method traverses the array in the parameters and returns the mean average of the numbers in the array.
Inside your main method, prompt the user for a size for the array you are about to create; keep prompting the user if they enter a size thats less than Once the user enters a valid number, create an integer array of that size.
Next, prompt the user for enough numbers to fill the whole array. These numbers can be positive, negative, or
Next, ask the user if they want to find the smallest, the largest, or the mean average of all the numbers theyve entered keep prompting the user until they enter a valid choice Pass the array to the appropriate method and print the results.
Keep asking the user for an option until they enter the option to quit.
You can assume that the user will not enter doubles or strings when prompted for a number.
Sample input on the next page.
Sample output user input in bold:
How many numbers would you like to enter?
You must enter a value that is greater than
How many numbers would you like to enter?
You must enter a value that is greater than
How many numbers would you like to enter?
Enter number :
Enter number :
Enter number :
Enter number :
Enter number :
Find the smallest of the numbers entered
Find the largest of the numbers entered
Find the average of the numbers entered
Quit
Enter your option:
The smallest of the numbers you entered is
Find the smallest of the numbers entered
Find the largest of the numbers entered
Find the average of the numbers entered
Quit
Enter your option:
The largest of the numbers you entered is
Find the smallest of the numbers entered
Find the largest of the numbers entered
Find the average of the numbers entered
Quit
Enter your option:
The average of the numbers you entered is
Find the smallest of the numbers entered
Find the largest of the numbers entered
Find the average of the numbers entered
Quit
Enter your option:
That is not a valid option!
Find the smallest of the numbers entered
Find the largest of the numbers entered
Find the average of the numbers entered
Quit
Enter your option:
Shutting off...
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