-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpg127ex5.java
77 lines (74 loc) · 2.28 KB
/
pg127ex5.java
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
public class pg127ex5 {
public static final int size = 4;
public static void coneThruster() {
for (int line = 1; line <= 2*size-1; line++) {
for (int spaces = 1; spaces <= -line + size*2; spaces++) {
System.out.print(" ");
}
for (int slashes = 1; slashes <= line; slashes++) {
System.out.print("/");
}
System.out.print("**");
for (int slashes = 1; slashes <= line; slashes++) {
System.out.print("\\");
}
System.out.println();
}
}
public static void symLine() {
System.out.print("+");
for (int sym = 1; sym <= size*2; sym++) {System.out.print("=*");}
System.out.println("+");
}
public static void upArrow() {
for (int line = 1; line <= size; line++) {
System.out.print("|");
upDot(line);
for(int dots = 1; dots<=-1*line+size; dots++){
System.out.print(".");
}
upDot(line);
for(int dots = 1; dots<=-1*line+size; dots++){
System.out.print(".");
}
System.out.println("|");
}
}
public static void upDot(int line) {
for (int periods = 1; periods <= -1*line+size; periods++) {
System.out.print(".");
}
for (int arrows = 1; arrows <= line; arrows++) {
System.out.print("/\\");
}
}
public static void downArrow() {
for (int line = 1; line <= size; line++) {
System.out.print("|");
downDot(line);
downDot(line);
System.out.println("|");
}
}
public static void downDot(int line) {
for (int dots = 1; dots <= line-1; dots++) {
System.out.print(".");
}
for (int arrows = 1; arrows <= -1*line+size+1; arrows++) {
System.out.print("\\/");
}
for (int dots = 1; dots <= line-1; dots++) {
System.out.print(".");
}
}
public static void main(String[] args) {
coneThruster();
for(int reps = 1; reps<=size-1; reps++){
symLine();
upArrow();
downArrow();
}
symLine();
coneThruster();
}
}