I'm trying to write a code where you enter an integer in the console, and then the integer you entered is shown bigger, made up of letters (like ascii art).
So let's say the input is 112
. Then the output will be
# # #####
## ## # #
# # # # #
# # #####
# # #
# # #
##### ##### #######
My code will have the same output, just not in the same line :(
It will print one number under the other.. From my code you can see why:
import java.util.Scanner;
public class Tester {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
String any = input.nextLine();
String[] sArray = any.split("");
for(int i=0; i<sArray.length; i++){
if(sArray[i].equals("1")){
System.out.println(" # ");
System.out.println(" ## ");
System.out.println("# # ");
System.out.println(" # ");
System.out.println(" # ");
System.out.println(" # ");
System.out.println("#####");
}
if(sArray[i].equals("2")){
System.out.println(" ##### ");
System.out.println("# #");
System.out.println(" #");
System.out.println(" ##### ");
System.out.println("# ");
System.out.println("# ");
System.out.println("#######");
}
}
}
}
I somehow have to print all at once, not single output with println
as my code..
Maybe there is an easy way to solve that, preferably without changing my entire code? I can imagine it could be done with a 2d array as well, but not sure. Hints are very welcome too. And this is no homework.