public static void main(String[] args) {
char [][] asciiArt = {
{'H', 'X', 'X', 'X', 'X'},
{'X', 'X', 'I', 'P', 'X'},
{'X', 'X', 'X', 'X', 'X'},
{'D', 'D', 'X', 'R', '2'},
{'4', '4', '3', 'X', 'X'},
{'3', '9', '3', 'D', 'Y'}
};
System.out.println(asciiArt.length);
System.out.println(asciiArt[1].length);
for (int i = 0; i < asciiArt.length; i++) {
if (i % 2 == 1)
System.out.println(Arrays.toString(asciiArt[i]));
}
}
public static void main(String[] args) {
char [][] asciiArt = {
{'X', 'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X', 'X'}
};
update(asciiArt);
display(asciiArt);
}
public static void update(char [][] asciiArt) {
asciiArt[0][1] = 'O';
asciiArt[3][1] = 'O';
asciiArt[3][2] = 'O';
}
public static void display(char [][] asciiArt) {
for (int i = 0; i < asciiArt.length; i++) {
System.out.println(Arrays.toString(asciiArt[i]));
}
}
public static void main(String[] args) {
int [][] arr = new int[5][5];
fillTable(arr);
display(arr);
}
public static void fillTable(int [][] arr) {
for (int row = 0; row < arr.length; row++) {
for (int col = 0; col < arr[row].length; col++) {
arr[row][col] = row + col;
}
}
}
public static void display(int [][] arr) {
for (int i = 0; i < arr.length; i++) {
System.out.println(Arrays.toString(arr[i]));
}
}
public class MainApp {
public static void main(String[] args) {
// _______________________________________________
// TASK: CREATE AN ASCII BURGER OF YOUR CHOICE
// AND WRITE IT TO A TEXT FILE.
// ________________________________________________
File file = new File("burger.txt");
try {
PrintWriter printWriter = new PrintWriter (file);
printWriter.println(makeTopBun());
printWriter.println(makePattie());
printWriter.println(makeCheese());
printWriter.println(makePattie());
printWriter.println(makeBottomBun());
System.out.print(makeTopBun());
System.out.print(makePattie());
System.out.print(makeCheese());
System.out.print(makePattie());
System.out.print(makeBottomBun());
printWriter.close();
}
catch (IOException e){
System.out.println("This file could not be created.");
}
}
public static String makePattie() {
String str = " .o[.[[ :::::::::::::::::```````]| \n";
str += " [o```[;;;;;;;;;;;;;```::::::::]]:|' \n\n";
return str;
}
public static String makeBottomBun() {
String str = " {o{=======..==..=.````````````````'''''o}`\n";
str += " {o{{{ ssss{{{{{{oooooooooooooo}}}}}}o}}o} \n";
str += " {.{{{sSS.sssSS:ss::SS:sssss.SS.SSsssso}: \n\n";
return str;
}
public static String makeCheese() {
String str = " ~o=`=...~~~~~~...~~~++`+++++=====++>>>\n";
str += " <<<~~s>'<,,,,,,,+==<<>o~~~~~>>~~~~~~>>>'' \n\n";
return str;
}
public static String makeTopBun() {
String str = " ^ ^ '''......,.'' \n";
str += " `.://+++oooooooooooosssso+/-. \n";
str += " `-/o++;;ooooooooooooooooosssss++s+:` \n";
str += " `:+o++;o;oooooooooooooooooooosssssss++o:` \n";
str += " :+o++o;o;oooooooooooooooooooooosssssssss++/` \n";
str += " `/o++o;oo;ooooooooooooooooooooooosssssssss++o. \n";
str += " +o++o;o;ooooooooooooooooooooossssssssssss;;s+/ \n";
str += " {{:+/:::-....:::::::::............oooo::::}::}} \n\n";
return str;
}
}