forked from Ryan-Karanja/Rocket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrocket.java
More file actions
104 lines (87 loc) · 4.13 KB
/
rocket.java
File metadata and controls
104 lines (87 loc) · 4.13 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
import java.util.Scanner;
public class rocket{
public static void main(String args[]){
int userInput;
Scanner scnr = new Scanner(System.in);
System.out.print("What is the size of the rocket: ");
userInput = scnr.nextInt();
//yeet
cone(userInput);
middle(userInput);
topHalf(userInput);
bottomHalf(userInput);
middle(userInput);
bottomHalf(userInput);
topHalf(userInput);
middle(userInput);
cone(userInput);
}
public static void cone(int userIn){
int lines = (userIn * 2) - 1;
for(int row = 0; row < lines; row++){ // this loop makes sure that it prints out things line by line
for(int space = (lines - (row - 1)) - 2; space >= 0; space--){ // this loop prints out the amount of spaces before printing
System.out.print(" "); //out the slashes to the left of the stars
}
for(int slash = 0; slash <= row; slash++){ // this loop prints out the slashes to the left of the stars
System.out.print("/");
}
System.out.print("##");
for(int slash = 0; slash <= row; slash++){ // this loop prints out the slashes to the right of the stars of the cone.
System.out.print("\\");
}
System.out.println();
}
}
public static void topHalf(int userIn){
for(int line = userIn, row = 0; line > 0; line--){ // this loop makes sure that everything is printed line by line.
row++;
System.out.print("|");
for(int periods = 0; periods < (line - 1); periods++){ //this for loop creates the periods before the slashes on the top half
System.out.print("."); // part.
}
for(int slash = 0; slash < row; slash++){ // this for loop creates the slashes on the left half of the ship
System.out.print("/\\");
}
for(int periods = 0; periods < ((line - 1) * 2); periods++){ //this loop adds the periods in the middle of the slashes on the
System.out.print("."); // left and right half of the ship
}
for(int slash = 0; slash < row; slash++){ // this loop adds the slashes on the right side of the ship
System.out.print("/\\");
}
for(int periods = 0; periods < (line - 1); periods++){ // this loops adds the periods thats to the right of the slashes on the
System.out.print("."); // right half of the ship.
}
System.out.print("|");
System.out.println();
}
}
public static void bottomHalf(int userIn){
for(int line = userIn, row = 0; row < line; row++){ // this loop makes sure that things are printed line by line
System.out.print("|");
for(int periods = 0; periods < row; periods++){ // this loop prints the periods on the left side of the ship.
System.out.print(".");
}
for(int slash = userIn; slash > row; slash--){ //this loop prints out the slashes on the left side of the ship
System.out.print("\\/");
}
for(int periods = 0; periods < row * 2; periods++){ // this loop prints the periods in the middle of the left and right slashes
System.out.print(".");
}
for(int slash = userIn; slash > row; slash--){ // this loop prints the periods in the right side of the ship
System.out.print("\\/");
}
for(int periods = 0; periods < row; periods++){ // this loop prints the periods in the right side of the ship.
System.out.print(".");
}
System.out.print("|");
System.out.println();
}
}
public static void middle(int userIn){
System.out.print("+");
for(int i = userIn * 2, star = 0; star < i; star++){ // this loop prints the total =* that separates each part of the ship,
System.out.print("=*");
}
System.out.println("+");
}
}