Question: Follow the following steps: 1) Write a Java class named Rectangle with integer data members named width and length. The class should have two constructors,
Follow the following steps:
1) Write a Java class named Rectangle with integer data members named width and length. The class should have two constructors, get/set methods, a getArea method, and a toString method;
2) In the test driver class, create a LinkedList object called RectangeList which can hold Rectangle objects;
3) Write a method called fillList which has a parameter list for receiving the above RectangleList and a desired size . In this method, use a loop to create the desired number of Rectagle objects with random integer width and length values in the range of 1 to 10. Each time a new Rectagle object is created, it is added to the end of RectangleList;
4) Write a method called displayTotalArea which receives the RectangleList through a parameter. This method steps through the RectangleList, finds the total area of all Rectagle objects in it and displays the total area;
5) Test your code and take screenshots. Submit your output screenshots and Java code
(must use given strings)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
