-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawRocket.java
More file actions
58 lines (55 loc) · 1.43 KB
/
DrawRocket.java
File metadata and controls
58 lines (55 loc) · 1.43 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
/**
* Created by fattyduck on 3/13/15.
*/
import java.util.Scanner;
public class DrawRocket {
public static void drawHead(int size){
for (int i=0; i<size; i++){
for(int s=0; s<size-i;s++){
System.out.print(" ");
}
for (int x=0; x<=i; x++){
System.out.print('/');
}
System.out.print("**");
for (int b=0;b<=i; b++){
System.out.print('\\');
}
System.out.println();
}
}
public static void drawLine(int size){
String line="+";
for (int i =0; i<=size; i++){
line+="--";
}
line+="+";
System.out.println(line);
}
public static void drawBody(int size){
for (int i=0; i<=size; i++){
String body="|";
for (int d=0; d<size+1; d++){
body+="XX";
}
body+="|";
System.out.println(body);
}
}
public static void drawRocket(int size){
drawHead(size);
drawLine(size);
drawBody(size);
drawLine(size);
drawBody(size);
drawLine(size);
drawHead(size);
}
public static void main(String[] args){
Scanner cow=new Scanner(System.in);
int allan;
System.out.println("How big do you want your rocket to be?");
allan=cow.nextInt();
drawRocket(allan);
}
}