Question
Laboratory Tasks: Write a java application ArrayOperations that includes the following methods: AverageArray : method accepts an array as a parameter and calculates the average
Laboratory Tasks:
Write a java application ArrayOperations that includes the following methods:
AverageArray : method accepts an array as a parameter and calculates the average value. (2
marks)
DiplayBackward: method accepts an array as a parameter and prints the elements of that array
in backward order. (2 marks)
CountNegativePositive: method accepts an array as a parameter, then counts and prints how
many negative numbers and how many positive numbers. (2 marks)
MinMaxArray: method that accepts an array as a parameter and returns the largest number and
the smallest number. (2 marks)
CountOddEven : method accepts an array as a parameter, then counts and prints how many odd
numbers and how many even numbers. (2 marks)
CompareArray : method that accepts two arrays as parameters and returns true if they are equal
or false if not equal. (2 marks)
ReplaceElement: method that accepts an array and an integer value as parameters, replaces the
element from the array by -99 and returns the updated array. (2 marks)
AddElement : method that accepts an array and an integer value as parameters, copies the array
to a new array, inserts the element at the end of the new array, and returns the new array. (2
marks)
Main: method that tests all the previous 8 methods. (4 marks)
Note: the user needs to enter how many elements or the size of the array, then all values of the elements should be entered from the keyboard.
Program code Screenshot including package explorer, program, console
please type the code to cope it
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