Ask Question
18 April, 04:52

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.

+3
Answers (1)
  1. 18 April, 05:48
    0
    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a class named Location for locating a maximal value and its location in a two-dimensional array. The class contains public data ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers