Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

solve in netbeans A 2D array in which the length of the array is different from the length of the individual arrays in the 2D

solve in netbeans
image text in transcribed
image text in transcribed
A 2D array in which the length of the array is different from the length of the individual arrays in the 2D array is a non- square array A 2D array in which the length of the array is same as the length of each individual array in the 2D array is a square array. This may be specified as 3 x 3, 4 x 4 etc. A 2D array in which the length of the array is different from the length of the individual arrays and the individual arrays have different lengths is a ragged array. Utilizing the following method name and specifications, write the Java static method code that would perform the indicated operation in a single Java class. 1. METHOD NAME: sumEvenValues SPECIFICATION: Accepts a 2D integer array (may be a ragged array) and returns the sum of all the values in the array that are even. This method must utilize a switch statement to determine if a number is even. 2. METHOD NAME: countOddValues SPECIFICATION: Accepts a 2D integer array that must be a square array and returns the number of odd values in the array. If the array is not square a 0 is returned and 'Input is Not Square' is displayed to the console. 3. METHOD NAME: array Min Max SPECIFICATION: Accepts a 2D integer array and returns a 1D integer array containing the minimum and maximum values in the array. 4. METHOD NAME: changeArrayDimensions SPECIFICATION: Accepts a 2D integer array and returns a 1D integer array containing all the values in the 2D integer array. 5. METHOD NAME: mainDiagonali SPECIFICATION: Accepts no parameters and returns a 2D integer square array (3 x 3) which contains l's on the main diagonal of the array and O's everywhere else. You must use a for loop in this method. 6. METHOD NAME: formatted Array SPECIFICATION: Accepts a 2D double array that contains no value less than 1000 and returns a 2D String array in which each value in the array has been formatted with a comma to delimit thousands and has 2 decimal places. If the argument array contains a value less than 1000, a 2D (3 x 3) String array, in which each value in the array is "SW", is returned. METHOD NAME: sum Product 7. SPECIFICATION: Accepts a variable number of integers (cannot be an array) and returns the sum of the integers multiplied by the product of the integers as well displays (on a single line) each of the integers specified in the argument to the method. 8. METHOD NAME: euclidean2DDistance SPECIFICATION: Accepts four integers which represent the X and Y Coordinates of two points and returns the Euclidean distance between them. 9. METHOD NAME: not5Inverses SPECIFICATION: Accepts a 2D integer array which must not contain the any value less than 5 and returns a 2D double array which contains the inverse of each value in the array. If the argument to the method contains a value less than 5 then a 2D double square array (3 x 3) is returned that contains only Os. 10. METHOD NAME: totalCost SPECIFICATION: Accepts the cost of an item (double) and the sales tax percent (double) and returns the total cost of the item based on the formula ... Total Item Cost = Total Cost + (Total Cost * Sales Tax Percent)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

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

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

4. Show the trainees how to do it again.

Answered: 1 week ago

Question

8. Praise the trainees for their success in learning the task.

Answered: 1 week ago