SHARE
TWEET

Untitled

advictoriam Jan 15th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Solution checker broken
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class DrawRects
  6. {
  7.    /**
  8.       A method to display a rectangle of dimension <tt>height</tt>
  9.       by <tt>width</tt>. If the width or height are > 25, don't
  10.       display anything.
  11.       @param width, the width of the rectangle to be drawn
  12.       @param height, the height of the rectangle to be drawn
  13.    */
  14.    public static void displayRectangle(int width, int height)
  15.    {
  16.       for(int i = 0; i < height; i++)
  17.       {
  18.          for(int j = 0; j < width; j++)
  19.          {
  20.             System.out.print("[]");
  21.          }
  22.          System.out.println();
  23.       }
  24.    }
  25.  
  26.    /**
  27.       The main method reads the width and height and invokes your method.
  28.    */
  29.    public static void main(String[] args)
  30.    {
  31.       Scanner in = new Scanner(System.in);
  32.       int w = in.nextInt();
  33.       int h = in.nextInt();
  34.       displayRectangle(w, h);
  35.    }
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top