Ask Question

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.

+4
Answers (1)
  1. 17 February, 06:25
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers