Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.Suarez;
- // Arush Adabala
- // 12/13/2018
- // This Program prints a series of back slashes and forward slashes. It creates Challenge 1.
- public class ChallengeCopy {
- public static final int SIZE = 4;
- public static void main(String[] args)
- {
- BreakLine();
- Top();
- Bottom();
- BreakLine();
- Bottom();
- Top();
- BreakLine();
- }
- public static void BreakLine ()
- {
- System.out.print("+");
- for(int i=1;i<=2*SIZE+1;i++)
- {
- System.out.print("-");
- }
- System.out.println("+");
- }
- public static void Top () {
- for (int interval = 1; interval <= SIZE; interval++)
- {
- System.out.print("|");
- for (int space = SIZE-interval; space >= 0; space--) {
- System.out.print(" ");
- }
- for (int slash = SIZE-interval; slash <= SIZE-2; slash++) {
- System.out.print("/");
- }
- System.out.print("*");
- for (int slash = SIZE-interval; slash <= SIZE-2; slash++) {
- System.out.print("\\");
- }
- for (int space = SIZE-interval; space >= 0; space--) {
- System.out.print(" ");
- }
- System.out.println("|");
- }
- }
- public static void Bottom () {
- for (int interval = SIZE; interval >= 1; interval--)
- {
- System.out.print("|");
- for (int space = SIZE-interval; space >= 0; space--) {
- System.out.print(" ");
- }
- for (int slash = SIZE-interval; slash <= SIZE-2; slash++) {
- System.out.print("\\");
- }
- System.out.print("*");
- for (int slash = SIZE-interval; slash <= SIZE-2; slash++) {
- System.out.print("/");
- }
- for (int space = SIZE-interval; space >= 0; space--) {
- System.out.print(" ");
- }
- System.out.println("|");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement