przykladowe-projekty/Litery_porojekt

166 lines
6.6 KiB
Plaintext
Raw Normal View History

class Litery {
private int wys;
private String slowo;
private String[] lista_slow;
Litery(int wys, String slowo) {
this.wys = wys;
this.slowo = slowo;
lista_slow = slowo.split("\n");
}
private int ile = (wys - 3) / 2;
private int index = 0;
private boolean np = true;
private char litera;
private String[] a = {" AAA ", "A A", "AAAAA", "A A", "A A"};
private String[] b = {"BBBB ", "B B", "BBBB ", "B B", "BBBB "};
private String[] c = {" CCCC", "C ", "C ", "C ", " CCCC"};
private String[] d = {"DDDD ", "D D", "D D", "D D", "DDDD "};
private String[] e = {"EEEEE", "E ", "EEEEE", "E ", "EEEEE"};
private String[] f = {"FFFFF", "F ", "FFFF ", "F ", "F "};
private String[] g = {" GGG ", "G ", "G GGG", "G G", " GGG "};
private String[] h = {"H H", "H H", "HHHHH", "H H", "H H"};
private String[] i = {" III ", " I ", " I ", " I ", " III "};
private String[] j = {" JJJ", " J", " J", "J J", " JJJ "};
private String[] k = {"K K", "K K ", "KK ", "K K ", "K K"};
private String[] l = {"L ", "L ", "L ", "L ", "LLLLL"};
private String[] m = {"M M", "MM MM", "M M M", "M M", "M M"};
private String[] n = {"N N", "NN N", "N N N", "N NN", "N N"};
private String[] o = {" OOO ", "O O", "O O", "O O", " OOO "};
private String[] p = {"PPPP ", "P P", "PPPP ", "P ", "P "};
private String[] q = {" QQQ ", "Q Q", "Q Q", " QQQ ", " Q "};
private String[] r = {"RRRR ", "R R", "RRRR ", "R R ", "R R"};
private String[] s = {" SSS ", "S ", " SSS ", " S", " SSS "};
private String[] t = {"TTTTT", " T ", " T ", " T ", " T "};
private String[] u = {"U U", "U U", "U U", "U U", " UUU "};
private String[] v = {"V V", "V V", " V V ", " V V ", " V "};
private String[] w = {"W W", "W W", "W W W", "WW WW", "W W"};
private String[] x = {"X X", " X X ", " X ", " X X ", "X X"};
private String[] y = {"Y Y", " Y Y ", " Y ", " Y ", " Y "};
private String[] z = {"ZZZZZ", " Z ", " Z ", " Z ", "ZZZZZ"};
private String[] spacja = {" ", " ", " ", " ", " "};
public void wypisz(){
for (int jj = 0; jj < lista_slow.length; jj++) {
for (int ii = 0; ii < wys; ii++) {
for (int xx = 0; xx < lista_slow[jj].length(); xx++) {
litera = lista_slow[jj].charAt(xx);
if (litera == 'a') {
System.out.print(a[index]);
} else if (litera == 'b') {
System.out.print(b[index]);
} else if (litera == 'c') {
System.out.print(c[index]);
} else if (litera == 'd') {
System.out.print(d[index]);
} else if (litera == 'e') {
System.out.print(e[index]);
} else if (litera == 'f') {
System.out.print(f[index]);
} else if (litera == 'g') {
System.out.print(g[index]);
} else if (litera == 'h') {
System.out.print(h[index]);
} else if (litera == 'i') {
System.out.print(i[index]);
} else if (litera == 'j') {
System.out.print(j[index]);
} else if (litera == 'k') {
System.out.print(k[index]);
} else if (litera == 'l') {
System.out.print(l[index]);
} else if (litera == 'm') {
System.out.print(m[index]);
} else if (litera == 'n') {
System.out.print(n[index]);
} else if (litera == 'o') {
System.out.print(o[index]);
} else if (litera == 'p') {
System.out.print(p[index]);
} else if (litera == 'q') {
System.out.print(q[index]);
} else if (litera == 'r') {
System.out.print(r[index]);
} else if (litera == 's') {
System.out.print(s[index]);
} else if (litera == 't') {
System.out.print(t[index]);
} else if (litera == 'u') {
System.out.print(u[index]);
} else if (litera == 'v') {
System.out.print(v[index]);
} else if (litera == 'w') {
System.out.print(w[index]);
} else if (litera == 'x') {
System.out.print(x[index]);
} else if (litera == 'y') {
System.out.print(y[index]);
} else if (litera == 'z') {
System.out.print(z[index]);
} else if (litera == ' ') {
System.out.print(spacja[index]);
}
System.out.print(" ");
}
System.out.print("\n");
if (index < 4) {
if (index == 1) {
ile--;
if ((wys - 3) % 2 != 0 && np == true) {
ile++;
np = false;
}
if (ile == 0) {
index++;
}
} else if (index == 3) {
ile--;
if (ile == 0) {
index++;
}
} else {
index++;
ile = (wys - 3) / 2;
}
}
}
index = 0;
ile = (wys - 3) / 2;
np = true;
}
if (slowo == lista_slow[lista_slow.length - 1] && lista_slow.length > 1) {
for (int ll = 0; ll < wys; ll++) {
System.out.println("\n");
}
}
}
}
public class projekt {
public static void main(String[] args) {
int wys;
String slowo;
if (args.length > 1) {
wys = Integer.parseInt(args[0]);
slowo = args[1];
}
else {
wys = 5;
slowo = "dzien dobry";
}
Litery l1 = new Litery(wys,slowo);
l1.wypisz();
}
}