Advertisement
kmtz

3

Nov 15th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1.  
  2. public class Aufgabe3 {
  3.     public static void main(String[] args) {
  4.         int width = 400, height = 440;
  5.         StdDraw.setCanvasSize(width,height);
  6.         StdDraw.setXscale(0,400);
  7.         StdDraw.setYscale(0,440);
  8.  
  9.         int xSquare = 20, ySquare = 20;
  10.         int xRectangle = 40, yRectangle = 40;
  11.  
  12.         for (int i = 0; i <= 11; i++) {
  13.             for (int j = 0; j <= 10; j++) {
  14.                 if(j % 2 != 0){
  15.                     StdDraw.setPenColor(90,90,0);
  16.                     StdDraw.filledSquare(xSquare,ySquare,20);
  17.                     xSquare += 40;
  18.  
  19.                 }else{
  20.                     StdDraw.setPenColor(166,166,76);
  21.                     StdDraw.filledSquare(xSquare,ySquare,20);
  22.                     xSquare += 40;
  23.  
  24.                 }
  25.             }
  26.                 if(i % 2 == 0){
  27.                     xSquare = -20;
  28.                 }else {
  29.                     xSquare = 20;
  30.                 }
  31.                 ySquare += 40;
  32.  
  33.         }
  34.  
  35.  
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement