diff options
author | msglm <msglm@techchud.xyz> | 2023-01-14 05:31:48 -0600 |
---|---|---|
committer | msglm <msglm@techchud.xyz> | 2023-01-14 05:31:48 -0600 |
commit | 9d53d8857eaa1c9405894a88ca75bc4657e42f35 (patch) | |
tree | eb1efc1d028b949dd83bb710c68be8eff58f26e7 /Java/DrawDiamond.java | |
download | school-code-master.tar.gz school-code-master.tar.bz2 school-code-master.zip |
Diffstat (limited to 'Java/DrawDiamond.java')
-rw-r--r-- | Java/DrawDiamond.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Java/DrawDiamond.java b/Java/DrawDiamond.java new file mode 100644 index 0000000..7e744a3 --- /dev/null +++ b/Java/DrawDiamond.java @@ -0,0 +1,48 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; +//horrible recursive for loops are not fun +//they aren't a good way to teach something +//why can't we do fizzbuzz? +//or make small games? +//or do data manipulation? +//or solve a problem? +//or something more enjoyable than this? +//maybe CS really should stay a hobbiest, self taught skill +//at least when its a hobby you learn what matters at your own pace +//here its just being given an unrealistic task that, albiet difficult, is not rewarding +//making a diamond like this doesn't teach me good programming +//it teaches me for loops +//and nested for loops are usually not a good way to go about things +//I just want to make command line tools and data parsers for gods sake! +//maybe mom was right, I should just go for law +//sysadmining seems nice though, I could do that +//yeah, law or sysadmin. That seems nice +//or I could write and edit for a living, that doesn't seem too bad +class Diamond { + public static void main(String[] args) throws java.io.IOException { + BufferedReader dmndsizeI = new BufferedReader(new InputStreamReader(System.in)); + + System.out.println("input size"); + int dmndsize = Integer.parseInt(dmndsizeI.readLine()); + + for (int i = 1; i < dmndsize; i += 2) { + for (int j = 0; j < dmndsize -1 - i / 2; j++) + System.out.print(" "); + + for (int j = 0; j < i; j++) + System.out.print("*"); + + System.out.print("\n"); + } + + for (int i = 7; i > 0; i -= 2) { + for (int j = 0; j < 9 - i / 2; j++) + System.out.print(" "); + + for (int j = 0; j < i; j++) + System.out.print("*"); + + System.out.print("\n"); + }}} + +//By msglm; Licensed under the AGPL v3 |