Question: Please answer quick! It is due soon! (There are 3 parts) Examine the following starter code. Use the comments and the code provided to complete

Please answer quick! It is due soon! (There are 3 parts)

Please answer quick! It is due soon! (There are 3 parts) Examinethe following starter code. Use the comments and the code provided tocomplete the constructor and two methods in the RectangleStats class. import java.util.ArrayList;

Examine the following starter code. Use the comments and the code provided to complete the constructor and two methods in the RectangleStats class. import java.util.ArrayList; class RectangleStats { // Private instance variables // length is an ArrayList which will contain integer values, width is an array which will contain integer // values, and area is an array which will contain decimal values. Il code goes here for instance variables goes here // The constructor for the RectangleStats class takes an ArrayList and an array as parameters for // length and width, respectively. // code for constructor goes here // The calcRectangleArea() method calculates the area of rectangles using the length and // the width assigned to the private instance variables and assigns the results to the area array of type // The printArea() method prints the values assigned to the area array using the most appropriate // type of loop. This method does not return anything. // code for the printArea() method goes here } // The RectangleStats TesterClass assigns the length of two rectangles to an ArrayList and assigns the // width of two rectangles to an array. The calcRectangleAreal and printArea(methods are invoked to // calculate and print the area of the two rectangles. public class RectangleStats TesterClass2 { public static void main(String[] args) { ArrayList intLength = new ArrayList0; intLength.add(7); intLength.add(5); int[] intWidth = {3,4}; RectangleStats rectStats = new RectangleStats(intLength intWidth): rectStats.calcRectangleArea); rectStats.printArea(); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!