Write a class named Location for locating a maximal value and its location in a two-dimensional array. The class contains public data fields row, column, and maxValue that store the maximal value and its indices in a two dimensional array with row and column as int type and maxValue as double type. The class also contains a constructor Location(row, column, maxValue) for creating an instance with the specified row, column, and maxValue.

Respuesta :

ijeggs

Answer:

public class Location {

//Class member (instance) variables    

public int row;

   public int col;

   public double maxValue;

   //The constructor

   public Location(int row, int col, double maxValue) {

       this.row = row;

       this.col = col;

       this.maxValue = maxValue;

   }

}

Explanation:

  • Above is the solution in Java
  • The three instance variables are created with public access modifier, and respective data types as required by the question
  • A constructor that initializes the three fields is also created.
ACCESS MORE