-
Notifications
You must be signed in to change notification settings - Fork 0
/
StarText.java
167 lines (159 loc) · 3.85 KB
/
StarText.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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
package warGame;
/*
* Change text to large letters written with stars.
* NOT part of assignment 3 wargame. Only used to write the title of the game
* I coded this during my first semester at heritage
*
*
*
*/
public class StarText {
private final String r1 = "* ", r1c = "* * ", c = " * ", r2l2 = " * * ", r2 =" * ", f = "* * * ";
private final String l2 = " * ", cl1 = " * * ", l1 = " * ", space = " ",r1l1 = "* * ", e = " ";
private String line1, line2, line3, line4, line5, line6;
public StarText() {
}
private void setLines(String ln1, String ln2, String ln3, String ln4, String ln5){
line1 += ln1;
line2 += ln2;
line3 += ln3;
line4 += ln4;
line5 += ln5;
}
public String toStarText(String words) {
String letter;
line1 = "";
line2 = "";
line3 = "";
line4 = "";
line5 = "";
for (int x=0;x<words.length();x++) {
letter = words.substring(x, x+1);
switch(letter.toUpperCase()) {
case "A":
setLines(c, r1l1, f, r1l1, r1l1);
break;
case "B":
setLines(r1c, r1l1, r1c, r1l1, r1c);
break;
case "C":
setLines(cl1, r1, r1, r1, cl1);
break;
case "D":
setLines(r1c, r1l1, r1l1, r1l1, r1c);
break;
case "E":
setLines(f, r1, r1c, r1, f);
break;
case "F":
setLines(f, r1, r1c, r1, r1);
break;
case "G":
setLines(cl1, r1, "* ** ", r1l1, cl1);
break;
case "H":
setLines(r1l1, r1l1, f, r1l1, r1l1);
break;
case "I":
setLines("*** ", " * ", " * ", " * ", "*** ");
break;
case "J":
setLines(" *** ", l2, l2,"* * ", " ** ");
break;
case "K":
setLines(r1l1, r1c, "** ", r1c, r1l1);
break;
case "L":
setLines(r1, r1, r1, r1, f);
break;
case "M":
setLines(" ** ** ", "* * * ", "* * * ", "* * ", "* * ");
break;
case "N":
setLines("** * ", f, f, f, "* ** ");
break;
case "O":
setLines(r2l2, r1l1, r1l1, r1l1, r2l2);
break;
case "P":
setLines(r1c, r1l1, r1c, r1, r1);
break;
case "Q":
setLines(r2l2, r1l1, r1l1, r2l2, l1);
break;
case "R":
setLines(r1c, r1l1, r1c, "* * ", r1l1);
break;
case "S":
setLines(cl1, r1, c, l1, r1c);
break;
case "T":
setLines(f, c, c, c, c);
break;
case "U":
setLines(r1l1, r1l1, r1l1, r1l1, r2l2);
break;
case "V":
setLines(r1l1, r1l1, r1l1, r2l2, c);
break;
case "W":
setLines("* * ", "* * ", "* * * ", " * * * ", " * * ");
break;
case "X":
setLines(r1l1, r2l2, c, r2l2, r1l1);
break;
case "Y":
setLines(r1l1, r2l2, c, c, c);
break;
case "Z":
setLines(f, l2, c, r2, f);
break;
case " ":
setLines(space, space, space, space, space);
break;
case ".":
setLines(space, space, space, space, "* ");
break;
case "?":
setLines(c, r1l1, l2, e, l2);
break;
case "!":
setLines("* ", "* ", "* ",space, "* ");
break;
case "0":
setLines(r2l2, "* ** ", f, "** * ",r2l2);
break;
case "1":
setLines(" * ", "** ", " * ", " * ", "*** ");
break;
case "2":
setLines(r1c, l1, c, r1, f);
break;
case "3":
setLines(r1c, l1, " ** ", l1, r1c);
break;
case "4":
setLines(r1l1, r1l1, f, l1, l1);
break;
case "5":
setLines(f, r1, r1c, l1, r1c);
break;
case "6":
setLines(c, r1, r1c, r1l1, c);
break;
case "7":
setLines(f, l2, c, r2, r1);
break;
case "8":
setLines(c, r1l1, r2l2, r1l1, c);
break;
case "9":
setLines(c, r1l1, cl1, l1, c);
break;
default:
setLines(e, e, e, e, e);
}
}
return (line1+"\n"+line2+"\n"+line3+"\n"+line4+"\n"+line5);
}
}