Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package drawbox;
- public class Main {
- public static int height;
- public static int length;
- public static void main(String[] args) {
- drawBox(10, 50);
- }
- public static void drawBox(int height, int length) {
- for (int i = 0; i <= height; i++) {
- if (i == 0 || i == height) {
- startEndLines();
- } else if ((i > 0) && (i < height)) {
- System.out.print("|");
- for (int j = 1; j < length; j++) {
- System.out.print(" ");
- }
- System.out.println("|");
- }
- }
- }
- public static void startEndLines() {
- for (int i = 0; i <= length; i++) {
- if (i == 0) {
- System.out.print("*");
- } else if (i == length) {
- System.out.println("*");
- } else {
- System.out.print("-");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement