Repository navigation
Expand file tree
/
Copy pathSpaceNeedle.java
More file actions
110 lines (82 loc) · 3.15 KB
/
Copy pathSpaceNeedle.java
File metadata and controls
110 lines (82 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//Hailey Mandal, CS 210, Winter 2022, 1/17/2022, Chapter 02 (SpaceNeedle) //
public class SpaceNeedle {
//Class constant to set Space Needle height
public static final int SPACE_NEEDLE_HEIGHT = 5;
public static void main(String[] args) {
//These are all the static method calls needed to create SpaceNeedle
line();
needleTop();
needleBottom();
line();
stem();
needleTop();
}
/*Static method to create the antenna and neck of the needle.
It will include for loops to assist with the redundancy */
public static void line() {
for(int line = 1; line <= SPACE_NEEDLE_HEIGHT; line++) {
for(int space = 1; space <= SPACE_NEEDLE_HEIGHT*3; space++) {
System.out.print(" ");
}
System.out.println("||");
}
}
/*Static method to create the top of the needle and base.
It will include for loops to assist with the redundancy */
public static void needleTop() {
for(int line = 1; line <= SPACE_NEEDLE_HEIGHT; line++) {
for(int space = 1; space <= (line * -3 + (SPACE_NEEDLE_HEIGHT*3)); space++) {
System.out.print(" ");
}
System.out.print("__/");
for(int colon = 1; colon <= (3 * line - 3); colon++){
System.out.print(":");
}
System.out.print("||");
for(int colon = 1; colon <= (3 * line - 3); colon++){
System.out.print(":");
}
/*
__/||\__ 1,12 -3 + 15
__/:::||:::\__ 2,9 -6 + 15
__/::::::||::::::\__ 3,6 -9 + 15
__/:::::::::||:::::::::\__ 4,3 -12 + 15
__/::::::::::::||::::::::::::\__ 5,0 -15 + 15
|""""""""""""""""""""""""""""""| k * (line + 1) + C, k*line + k + C, k=-3,
Height: k: c:
5 -3 15
6 -3 18
*/
System.out.println("\\__");
}
System.out.print("|");
for(int quote = 1; quote <= (SPACE_NEEDLE_HEIGHT*6); quote++) {
System.out.print("\"");
}
System.out.println("|");
}
/*Static method to create the stem of the needle.
It will include for loops to assist with the redundancy */
public static void stem() {
for(int line = 1; line <= SPACE_NEEDLE_HEIGHT * SPACE_NEEDLE_HEIGHT; line++) {
for(int space = 1; space <= (SPACE_NEEDLE_HEIGHT * 3 - 3); space++) {
System.out.print(" ");
}
System.out.println("|%%||%%|");
}
}
/*Static method to create the bottom of the needle.
It will include for loops to assist with the redundancy */
public static void needleBottom() {
for(int line = 1; line <= SPACE_NEEDLE_HEIGHT; line++) {
for(int space = 1; space <= (line * 2 - 2); space++) {
System.out.print(" ");
}
System.out.print("\\_");
for(int slash = 1; slash <= (line *-2 + (SPACE_NEEDLE_HEIGHT *3 + 1)); slash++) {
System.out.print("/\\");
}
System.out.println("_/" );
}
}
}