Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming Task 2 Location class Design a class called Location, it will be used to find and store the highest value in a 2D

Java programming

image text in transcribed

Task 2 Location class Design a class called Location, it will be used to find and store the highest value in a 2D array (i.e. a matrix). The class should have public data fields; rowno, columnNo, and maxValue. Select what type of data these should have. (Hint: int or double) In the Location class, write a method with the following signature that finds the location (rowNo and columnNo) for the item with the highest value: public void locateLargestElement (double [] [] matrix) In the Main method of the Oblig11Task2 class, write a static method that uses the random class to generate random numbers between 0.0 and 1000.0, and that uses them to fill in all the spaces in a 2D array. (Hint: start by creating a matrix that is 2 x 2) Double [] [matrix = new double [2] [2]; But your solution must pass a matrix that is N x N. Your answer will be tested with matrices that are e.g. 1000 x 1000. Also create a static method that prints the matrix to the terminal. (Hint. Look at ArrayUtilDemo.java) And finally, print which value in the matrix is the highest and which position it has. le. radNr and columnNo from the location object created in the Main method. It can be used e.g. such: Location location = new Location (); location locateLargest Element (matrix);||

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

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

Define a model.

Answered: 1 week ago

Question

3. Is IBMs program really a mentoring program? Why or why not?

Answered: 1 week ago