Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Solution checker broken
- import java.util.Scanner;
- public class DrawRects
- {
- /**
- A method to display a rectangle of dimension <tt>height</tt>
- by <tt>width</tt>. If the width or height are > 25, don't
- display anything.
- @param width, the width of the rectangle to be drawn
- @param height, the height of the rectangle to be drawn
- */
- public static void displayRectangle(int width, int height)
- {
- for(int i = 0; i < height; i++)
- {
- for(int j = 0; j < width; j++)
- {
- System.out.print("[]");
- }
- System.out.println();
- }
- }
- /**
- The main method reads the width and height and invokes your method.
- */
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- int w = in.nextInt();
- int h = in.nextInt();
- displayRectangle(w, h);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement