Answered step by step
Verified Expert Solution
Link Copied!

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

 

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. Consideration: 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

JAVA CODE import javautil class OddEven int arr2 double avgeven double avgodd public OddEve... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions

Question

what is a tangible asset ? please provide answer with references

Answered: 1 week ago