hi ,
please anyone could help me...i have a problem in the compilation of the below given program.
public class puzz
{
public static void main(
String args[])
{
dog[] d=new dog[6];
int x=0;
int y=1;
int result=0;
while(x<6)
{
dog[x]=new dog[];
d[x].v=y;
y=y*10;
x=X+1;
}
x=6;
while(x>0)
{
x=x-1;
result=result+d[x].do(x);
}
System.out.println("result is"+result)
}
}
class dog
{
int v;
public int do(int f)
{
if(v>100)
{
return v*f;
}
else
{
return v*(5-f);
}
}
}
the required output for the program is 543345.
when i compile i get some error messages like,illegal start of type,<identifier>expected, ; expected.....
i couldn't find where i am wrong.....