Before compiling the code, save the text as a text file named MyFile.txt.
click here to download the text file
And give the ADDRESS of MyFile.txt in the required line in the code.
Have Fun...
import java.io.*;
class better1
{
public static void main(String args[]) throws IOException
{
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a name:");
String S=br.readLine();
S=S.toLowerCase();
String D[][]=new String[26][8];
FileReader a=new FileReader("MyFile.txt");//MyFile sent as an attachment
BufferedReader b=new BufferedReader(a);
for(int i=0; i<26;i++)
for(int j=0; j<8;j++)
D[i][j]=b.readLine();
for(int i=0; i<=7; i++)
{
for(int j=0; j
char ch=S.charAt(j);
int c=ch-97;
if(ch==' ')
System.out.print(" ");
else
System.out.print(D[c][i]+" ");
}
System.out.println("");
}
b.close();
a.close();
}
}
No comments:
Post a Comment