Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.Suarez;
- /*
- Xander Fermier
- 12/13/18
- This is the program for the first challenge, mirrors. Generates a figure which has a variable size as declared by the constant SIZE
- */
- public class Challenge1 {
- public static final int SIZE = 6;
- public static void main(String [] args)
- {
- Line();
- Top();
- Bot();
- Line();
- Bot();
- Top();
- Line();
- }
- public static void Top()
- {
- for (int line=1; line <= SIZE; line++) {
- System.out.print("|");
- for (int space = 1; space <= SIZE - line + 1; space++) {
- System.out.print(" ");
- }
- for (int slash = 1; slash <= line - 1; slash++) {
- System.out.print("/");
- }
- System.out.print("*");
- for (int slashb = 1; slashb <= line - 1; slashb++) {
- System.out.print("\\");
- }
- for (int space = 1; space <= SIZE - line + 1; space++) {
- System.out.print(" ");
- }
- System.out.println("|");
- }
- }
- public static void Bot()
- {
- for(int line = 1; line <= SIZE; line++)
- {
- System.out.print("|");
- for (int space = 1; space <= line; space++)
- {
- System.out.print(" ");
- }
- for (int slashb = 1; slashb <= -line + SIZE; slashb++)
- {
- System.out.print("\\");
- }
- System.out.print("*");
- for (int slash = 1; slash <= -line+ SIZE; slash++)
- {
- System.out.print("/");
- }
- for (int space = 1; space <= line; space++)
- {
- System.out.print(" ");
- }
- System.out.println("|");
- }
- }
- public static void Line()
- {
- System.out.print("+");
- for (int dash = 1; dash <= SIZE*2+1; dash++)
- {
- System.out.print("-");
- }
- System.out.println("+");
- }
- }
Add Comment
Please, Sign In to add comment