i am trying to construct a pyramid like this (see attachment)
my code is
import acm.graphics.*; import acm.program.*; import java.awt.*; public class Pyramid extends GraphicsProgram { /** Width of each brick in pixels */ private static final int BRICK_WIDTH = 30; /** Height of each brick in pixels */ private static final int BRICK_HEIGHT = 12; /** Number of bricks in the base of the pyramid */ private static final int BRICKS_IN_BASE = 14; public void run() { int BaseBrick=BRICKS_IN_BASE, height=BRICK_HEIGHT,weidth=BRICK_WIDTH,x=5,y=300; while(BaseBrick!=0) { drawRow(BaseBrick,x,y,height,weidth); BaseBrick--; y-=12; x+=15; } } private void drawRow(int BaseBrick, int x, int y,int height, int weidth) { for(int i=0;i<BaseBrick;i++){ GRect rect = new GRect(x,y,weidth,height); add(rect); x+=30; } } }
after running the program i got my pyramid but also getting these error messages..(see attachments)
someone tell me where is loophole in my code