-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrawRocket2.java
More file actions
103 lines (90 loc) · 2.82 KB
/
drawRocket2.java
File metadata and controls
103 lines (90 loc) · 2.82 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
import java.util.Scanner;
/**
* Created by fattyduck on 3/16/15.
*/
public class drawRocket2 {
public static void drawhead(int size){
for (int row=0; row<size+size-1; row++){
for (int space=1; space<size+size-row; space++){
System.out.print(' ');
}
for (int fslash=0 ; fslash<=row; fslash++){
System.out.print('/');
}
System.out.print("**");
for (int fslash=0 ; fslash<=row; fslash++){
System.out.print('\\');
}
System.out.println();
}
}
public static void drawline(int size){
System.out.print("+");
for (int line=0; line<=(size*2-1); line++){
System.out.print("=*");
}
System.out.print("+");
System.out.println();
}
public static void bodyu(int size) {
for (int row = 1; row <= size; row++) {
System.out.print("|");
for (int dot = 1; dot <= (-1 * row) + size; dot++) {
System.out.print(".");
}
for (int up = 1; up <= row; up++) {
System.out.print("/\\");
}
for (int dot = 1; dot <= 2*((-1 * row) + size); dot++) {
System.out.print(".");
}
for (int up = 1; up <= row; up++) {
System.out.print("/\\");
}
for (int dot = 1; dot <= (-1 * row) + size; dot++) {
System.out.print(".");
}
System.out.print("|");
System.out.println();
}
}
public static void bodyd(int size) {
for (int row = 1; row <= size; row++) {
System.out.print("|");
for (int dot = 1; dot <= -1 + row; dot++) {
System.out.print(".");
}
for (int down = size - row + 1; down >= 1; down--) {
System.out.print("\\/");
}
for (int dot = 1; dot <= 2*(-1 + row); dot++) {
System.out.print(".");
}
for (int down = size - row + 1; down >= 1; down--) {
System.out.print("\\/");
}
for (int dot = 1; dot <= -1 + row; dot++) {
System.out.print(".");
}
System.out.print("|");
System.out.println();
}
}
public static void drawR(int size){
drawhead(size);
drawline(size);
bodyu(size);
bodyd(size);
drawline(size);
bodyu(size);
bodyd(size);
drawline(size);
drawhead(size);
}
public static void main(String[]args){
Scanner input=new Scanner(System.in);
System.out.println("Enter the rocket size you desire!");
int size = input.nextInt();
drawR(size);
}
}