Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions