Question: So far this is the code I have written, I cant seem to get the inner for loop correct. It iterates 30 times but the

So far this is the code I have written, I cant seem to get the inner for loop correct. It iterates 30 times but the arguments in the g.drawRect statement are incorrect.

Problem 3. Write Java class Squares. When executed, it should open a window and draw 30 squares in the pattern below. import java.awt.*; import javax.swing.JFrame; class Squares extends JFrame{ public static void main(String[] args) { Squares d = new Squares(); d.setSize(1000, 1000); d.setVisible(true); } public void paint(Graphics g) { for (int k=0; k
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
