Monty374

Box1

Oct 18th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. package display.box.pkg1;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class DisplayBox1 {
  6.  
  7. /**
  8. * @param args the command line arguments
  9. */
  10. public static void main(String[] args) {
  11. Scanner input = new Scanner(System.in);
  12. int height, width;
  13.  
  14. System.out.print("Enter height: ");
  15. height = input.nextInt();
  16.  
  17. System.out.print("\nEnter width: ");
  18. width = input.nextInt();
  19.  
  20. drawbox(height, width);
  21. }
  22.  
  23. public static void drawbar(int height, int width) {
  24. for (int i = 0; i < width; i++) {
  25. System.out.print("#");
  26. }
  27. System.out.print("\n");
  28. }
  29.  
  30. public static void drawbox(int height, int width) {
  31. for (int i = 0; i < height; i++) {
  32. drawbar(height, width);
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment