/*Wael Chami CMPS 200 Programming Projects Page 160 Exercise 3*/ // The following program prints the two mirrors containing adjusted upper and lower diamond shapes public class Practice { //The main method executes the static methods in order public static void main(String[] args) { line(); upperDiamond(); lowerDiamond(); line(); lowerDiamond(); upperDiamond(); line(); } //Outputs the line of hyphens and pluses public static void line() { System.out.print("+"); //Prints the + sign for(int minus=1; minus<=9; minus++) { System.out.print("-"); //Prints the - sign } System.out.println("+"); //Prints the + sign } //Outputs the upper diamond shape public static void upperDiamond() { for(int line=1; line<=4; line++) { System.out.print("|"); //Prints the border of bars | for(int spaces1=1; spaces1<=(-line+5); spaces1++) { System.out.print(" "); //Prints the spaces " " } for(int fSlash=1; fSlash<=(line-1); fSlash++) { System.out.print("/"); //Prints the front-slashes / } System.out.print("*"); //Prints the asterisks * for(int bSlash=1; bSlash<=(line-1); bSlash++) { System.out.print("\\"); //Prints the back-slashes \ } for(int spaces2=1; spaces2<=(-line+5); spaces2++) { System.out.print(" "); //Prints the spaces " " } System.out.println("|"); //Prints the border of bars | } } //Outputs the lower diamond shape public static void lowerDiamond() { for(int line=1; line<=4; line++) { System.out.print("|"); //Prints the border of bars | for(int spaces1=1; spaces1<=line; spaces1++) { System.out.print(" "); //Prints the spaces " " } for(int bSlash=1; bSlash<=(4-line); bSlash++) { System.out.print("\\"); //Prints the back-slashes \ } System.out.print("*"); //Prints the asterisks * for(int fSlash=1; fSlash<=(4-line); fSlash++) { System.out.print("/"); //Prints the front-slashes / } for(int spaces2=1; spaces2<=line; spaces2++) { System.out.print(" "); //Prints the spaces " " } System.out.println("|"); //Prints the border of bars | } } }