Menu

Examine Following Starter Code Use Comments Code Provided Complete Constructor Two Methods Q43818799

Examine the following starter code. Use the comments and thecode provided to complete the constructor and two methods in theRectangleStats class.

import java.util.ArrayList;
class RectangleStats
{

// Private instance variables

// width is an ArrayList which will contain decimal values,length is an array which will contain decimal

// values, and area is an array which will contain integervalues.

//code goes here for instance variables goes here

//The constructor for the RectangleStats class takes anArrayList and an array as parameters for

// width and length, respectively.

// code for constructor goes here

// The calcRectangleArea() method calculates the area ofrectangles using the length and width

// assigned to the private instance variables and assigns theresults to the area array of type int.

// This method does not return anything.

// code for the calcRectangleArea() method goes here

// The printArea() method prints the values assigned to the areaarray using the most appropriate

// type of loop. This method does not return anything.

// code for the printArea() method goes here

}

// The RectangleStatsTesterClass assigns the width of tworectangles to an ArrayList and assigns the
// length of two rectangles to an array. The calcRectangleArea()and printArea() methods are invoked to
// calculate and print the area of the two rectangles.
public class RectangleStatsTesterClass
{

public static void main(String[] args)

{

ArrayList<Double> dblWidth = newArrayList<Double>();

dblWidth.add(5.2);

dblWidth.add(9.3);

double [ ] dblLength = {11.1, 4.7};

RectangleStats rectStats = new RectangleStats(dblWidth,dblLength);

rectStats.calcRectangleArea();

rectStats.printArea();

}

}

Please answer in Java

Expert Answer


Answer to Examine the following starter code. Use the comments and the code provided to complete the constructor and two methods i…

OR