hi everyone,
can someone help me w/ this
here is my code:
import java.io.*;
public class Num2
{
public static void main(String[]args)throws IOException
{
BufferedReader a=new BufferedReader(new InputStreamReader(System.in));
String comma;
int r1, c1, r2, c2;
int[][]cards;
cards=new int[4][4];
for(int r=0; r<4; r++)
{
for(int c=0; c<4; c++)
{
cards[r][c]=(int) (Math.random() * 8 + 1);
System.out.print(cards[r][c]);
}
System.out.print("\n");
}
for (int r=0; r<4; r++)
{
for (int c=0; c<4; c++)
{
System.out.print("*");
}
System.out.print("\n");
}
System.out.print("\nPlease insert the first card row and column seperated by a comma.");
r1=Integer.parseInt(a.readLine());
comma=a.readLine();
c1=Integer.parseInt(a.readLine());
System.out.print("\nPlease insert the second card row and column seperated by a comma.");
r2=Integer.parseInt(a.readLine());
comma=a.readLine();
c2=Integer.parseInt(a.readLine());
//reveal
for(int r=0; r<4; r++)
{
for (int c=0; c<4; c++)
{
if((r==r1)&&(c==c1))
{
System.out.print(cards[r][c]);
}
else if((r==r2)&&(c==c2))
{
System.out.print(cards[r][c]);
}
else
{
System.out.print("*");
}
System.out.println();
}
//match?
if (cards[r1][c1]==cards[r2][c2])
{
}
else
{
}
//this pushes the next board onto a blank screen
for (int b=0; b<=20; b++)
System.out.println();
}
}
}
my problem here is once i entered the row and columns,there is nothing happens..pls help,
here's the error...
---------- Capture Output ----------
> "C:\jdk1.3.0_02\bin\java.exe" Num2
5373
7563
5732
8555
****
****
****
****
Please insert the first card row and column seperated by a comma.1,2
java.lang.NumberFormatException:
at java.lang.Integer.parseInt(Integer.java:426)
at java.lang.Integer.parseInt(Integer.java:454)
at Num2.main(Num2.java:29)
Exception in thread "main"
and also how to hide the values of the cards,
i mean only the * can only be seen,
once the row and the column is inputted,
the values will only show,
pls help w/ my program