Question: Implement a java method testShapeIFace(int numShapes) so that it has the following functionality: It should create a List of Shapes, using the standard Java

Implement a java method testShapeIFace(int numShapes) so that it has the following functionality:

 

It should create a List<> of Shapes, using the standard Java List/ArrayList classes.

It should then create and add numShapes random circles and numShapes random rectangles to this List and then loop through all list elements, drawing each of them. Use Math.random() to generate random numbers for the shape dimensions.

It should then scale all shapes in the list by a factor of 0.5 and re-draw the shapes, using a different colour. Shapes should be scaled about their centre.

more info:

I basically have a tester class:

"import java.util.ArrayList; import java.util.List; import java.awt.Color;

public class Tester { " and "public static void testShapeIFace(int numShapes) "is a method within the class. You can store the dimensions as array. lastly, i have an external jar file; "stdlib-package.jar", and when its the functio is called, it'll draw shapes.

Step by Step Solution

3.39 Rating (137 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javautilArrayList import javautilList import javaawt... View full answer

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 Programming Questions!