Answered step by step
Verified Expert Solution
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
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
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