import java.io.*;
class Parents
{ public int bottomare(int a,int b)
{ return a*b; }
}
class children extends Parents
{ public int children(int h,int a,int b)
{ return h*super(a,b);
}
}
class calculation
{ public static void main(String args[])
throws IOException
{ int a,b,c,area;
BufferedReader br=new BufferedReader(new InputStreamReader (System.in));
System.out.println("请分别输入立方体的长、宽、高:");
a=Integer.parseInt(br.readLine());
b=Integer.parseInt(br.readLine());
h=Integer.parseInt(br.readLine());
area=s.children(a,b,c);
System.out.println("立方体的体积为:"+area);
}
}
以上程序有若干错误,请高手帮我这个初学者改一下.万分感激.
class Parents
{ public int bottomare(int a,int b)
{ return a*b; }
}
class children extends Parents
{ public int children(int h,int a,int b)
{ return h*super(a,b);
}
}
class calculation
{ public static void main(String args[])
throws IOException
{ int a,b,c,area;
BufferedReader br=new BufferedReader(new InputStreamReader (System.in));
System.out.println("请分别输入立方体的长、宽、高:");
a=Integer.parseInt(br.readLine());
b=Integer.parseInt(br.readLine());
h=Integer.parseInt(br.readLine());
area=s.children(a,b,c);
System.out.println("立方体的体积为:"+area);
}
}
以上程序有若干错误,请高手帮我这个初学者改一下.万分感激.
public int Parents(int a, int b) {
return a * b;
}
public int Parents(int a, int b ,int h) {
Parents(a,b);
return h;
}
public static void main(String args[]) throws IOException {
int a, b, h, area;
calculation s = new calculation();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("请分别输入立方体的长、宽、高:");
a = Integer.parseInt(br.readLine());
b = Integer.parseInt(br.readLine());
h = Integer.parseInt(br.readLine());
area = s.Parents(a, b, h);
System.out.println("立方体的体积为:" + area);
}
}
class Parents
{ public int bottomare(int a,int b)
{ return a*b; }
}
class children extends Parents
{ public int children(int h,int a,int b)
{ return h*super.bottomare(a,b);
}
}
class calculation
{
public static void main(String args[])
throws IOException
{ int a,b,c,area;
children s = new children();
BufferedReader br=new BufferedReader(new InputStreamReader (System.in));
System.out.println("请分别输入立方体的长、宽、高:");
a=Integer.parseInt(br.readLine());
b=Integer.parseInt(br.readLine());
c=Integer.parseInt(br.readLine());
area=s.children(a,b,c);
System.out.println("立方体的体积为:"+area);
}
}
你那个s.childern()怎么调用
结果不正确呀!