Question: Someone please help. I've had two experts try this. The first one got it wrong and the second one gave me the picture that I
Someone please help. I've had two experts try this. The first one got it wrong and the second one gave me the picture that I presented as the answer along with wrong code. This is the code I currently have but it is wrong and I cannot figure it out.
public class SierpinskiSquare
public static void mainString args
int n Integer.parseIntargs;
StdDraw.setScale;
sierpinskin;
public static void sierpinskiint n double x double y double size
double halfSize size ;
if n
StdDraw.setPenColor;
double px x size, x x size, x ;
double py y y size, y y size ;
StdDraw.filledPolygonpx py;
return;
if n
StdDraw.setPenColor;
double px x size, x x size, x ;
double py y y size, y y size ;
StdDraw.filledPolygonpx py;
else
StdDraw.setPenColor;
StdDraw.filledSquarex y halfSize;
sierpinskin x halfSize, y halfSize, halfSize;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
