Created
September 9, 2015 21:03
-
-
Save AnEmortalKid/009f95ce42af3b6b7104 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Not completed, hey dude at least give this a try and finish it instead of asking people to do your homework plox | |
*/ | |
public class EmptyRectangle { | |
private static String createXAxisWall(int width) { | |
String firstStar = "*"; | |
String midDashes = ""; | |
for (int i = 0; i < width - 2; i++) { | |
midDashes += "-"; | |
} | |
String endStar = "*"; | |
return firstStar + midDashes + endStar; | |
} | |
private static String createMidWalls(int width) { | |
String leftSide = "|"; | |
String midSpaces = ""; | |
for (int i = 0; i < width - 2; i++) { | |
midSpaces += " "; | |
} | |
String rightSide = "|"; | |
return leftSide + midSpaces + rightSide; | |
} | |
public static void main(String[] args) { | |
// for a 4 height 3 rectangle we would do | |
// top | |
System.out.println(createXAxisWall(3)); | |
// need 2 rows of mid | |
for (int i = 0; i < 2; i++) | |
System.out.println(createMidWalls(3)); | |
// bottom | |
System.out.println(createXAxisWall(3)); | |
// TODO: You solve the rest | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment