Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that contains two overloaded methods that return the average of an array with the following headers: public static int average(int[] array) public
Write a program that contains two overloaded methods that return the average of an array with the following headers:
public static int average(int[] array)
public static double average(double[] array)
Write a program that prompts the user to enter ten integer values into an array named list1, invokes the appropriate method and displays the average value. The program then prompts the user to enter ten double values into an array named list2, invokes the appropriate method and displays the average value.
EC-lwindowslsystem321cmd.exe Average arrays Enter 10 integer values: 2 45 1 2 6 8 4 5 9 The average of the ten integers is 4 Enter 10 double values 2.5 1.2 4.5 8.1 2.3 7.5 7.5 8.4 6.9 9.5 Press any key to continue - The average of the ten doubles is 5.839999999999999 EC-lwindowslsystem321cmd.exe Average arrays Enter 10 integer values: 2 45 1 2 6 8 4 5 9 The average of the ten integers is 4 Enter 10 double values 2.5 1.2 4.5 8.1 2.3 7.5 7.5 8.4 6.9 9.5 Press any key to continue - The average of the ten doubles is 5.839999999999999
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