Question
How do I create a UML diagram for such a java class import java.util.Scanner; class Location { static int row, col; static double maxValue =
How do I create a UML diagram for such a java class
import java.util.Scanner; class Location { static int row, col; static double maxValue = 0; Location(int row, int col, double maxValue){ this.row = row; this.col = col; this.maxValue = maxValue; } public static Location locateLargest(double[][] a) { int maxRow = 0, maxCol = 0, cl; for (int rw = 0; rw < a[0].length - 1; rw++) { double currMax = a[rw][0]; int currMaxRow = rw; int currMaxCol = 0; for (cl = 0; cl < a[rw].length; cl++) { if (currMax < a[rw][cl]) { currMax = a[rw][cl]; currMaxRow = rw; currMaxCol = cl; } } if (maxValue < currMax) { maxRow = currMaxRow; maxCol = currMaxCol; maxValue = currMax; } } return new Location(maxRow, maxCol, maxValue); } }
public class Exercise09_13 { public static void main(String[] args) { double maxValue = 0; Location location; Scanner input = new Scanner(System.in); System.out.println("enter the number of rows and columns in the array: "); int row = input.nextInt(); int col = input.nextInt(); double[][] list = new double[row][col]; int cl, rw; System.out.println("enter the array"); for (rw = 0; rw < row; rw++) for (cl = 0; cl < col; cl++) list[rw][cl] = input.nextDouble(); new Location(row, col, list[row - 1][col - 1]); Location.locateLargest(list); System.out.println(" "); System.out.printf("the location of the largest element is %.2f at " + "(%d, %d)", Location.maxValue, Location.row, Location.col); } }
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