Created
May 17, 2017 01:49
-
-
Save colintsteele/dd51c3a3323edf88736538e0f959098a to your computer and use it in GitHub Desktop.
Completed assignment
This file contains hidden or 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
public void draw(int indentation) { //while | |
boolean shrinks = (topWidth > bottomWidth); | |
if(shrinks){ | |
for (int lineWidth = topWidth; lineWidth >= bottomWidth; lineWidth-= 2) { | |
int backgroundCharacterCount = (width - lineWidth)/2; | |
printLine(lineWidth, backgroundCharacterCount); | |
} | |
} else { | |
for (int lineWidth = topWidth; lineWidth <= bottomWidth; lineWidth+= 2) { | |
int backgroundCharacterCount = (width - lineWidth)/2; | |
printLine(lineWidth, backgroundCharacterCount); | |
} | |
} | |
} | |
public void printLine(int lineWidth, int backgroundCount){ | |
printCharacterRun('-', backgroundCount); | |
printCharacterRun('*', lineWidth); | |
printCharacterRun('-', backgroundCount); | |
printNewLine(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment