Need to know what type of two dimensional array is in this code? I have put it in bold below. Code works but do not know what kind of two dimensional array it is as I want to learn it package...


Need to know what type of two dimensional array is in this code? I have put it in bold below. Code works but do not know what kind of two dimensional array it is as I want to learn it


package IceCream;


public class Bonus {

    private int[][] matrix;


    public int getBonus(int weeks, int reviews) throws Exception {
           //if else statement
        if (weeks < 0="" ||="" reviews=""><>
            throw new Exception("Weeks and reviews cannot be less than zero");
        else if (weeks <= 6="" &&="" reviews=""><= 4)=""  =""  //if="" they="" are="" both="" equal="" to="" or="" less="" than="" 6="" weeks="" or="" 4="">
            return matrix[weeks][reviews];
        else if  (reviews < 4)=""  =""  =""  =""  =""  =""  =""  =""  =""  =""  //if="" reviews="" are="" less="" than="" 4="" and="" weeks="" more="" than="">
            return matrix[6][reviews];
        else if (weeks < 6)=""  =""  =""  =""  =""  =""  =""  =""  =""  =""  =""  =""  //if="" weeks="" is="" less="" than="" 6="" and="" reviews="" more="" than="">
            return matrix[weeks][4];
       else
            return matrix[6][4];                //takes care of out of bounds exception when both are more than 6/4
    }
    //7 rows(0 to 6) and 5 columns(0 to 4) 35 elements total in array
    //two dimensional array done as a matrix to simplify input

    public Bonus() {


        matrix = new int[7][5];


        matrix[0] = new int[] {25, 45, 80, 110, 150};


        matrix[1] = new int[] {50, 60, 90, 120, 180};


        matrix[2] = new int[] {100, 125, 160, 210, 265};


        matrix[3] = new int[] {160, 190, 225, 275, 340};


        matrix[4] = new int[] {230, 265, 325, 385, 450};


        matrix[5] = new int[] {300, 360, 420, 480, 600};


        matrix[6] = new int[] {425, 500, 600, 725, 875};

    }
       }



Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here