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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!