Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a JAVA program that reads a list of 25 values from the user. Put the values in an array. The program should read the
Write a JAVA program that reads a list of 25 values from the user. Put the values in an array. The program should read the array and then calculate and display the average of the even input values and the average of the odd input values. You should have a class and a tester. In the class, you will have three instance variable, 1) an array to hold the numbers, 2) a double to hold the odd average and a double to hold the even average. The constructor should accept as input the array from the tester class and assign it to the instant variable; it should also assign 0 to the even and odd average variables. You should then have a method that will read the array and then calculate the average of the even input values and the average of the odd input values. Your program will need a getOddAverage and a getEvenAverage method. The tester class will ask the user to input numbers (consider partially filled as well). It will then create an object passing the filled array to the class. The tester should then call the calculate the averages method. You will then need to print the even and odd average
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