import java.util.*;
import javax.swing.*;
class circle
{
public double r;
public circle(double r)
{
this.r=r;
}
public double getarea(){
return ((Math.PI)*r*r);
}
public double getperimeter(){
return (2*(Math.PI)*r);
}
public void setr(double R){
r=R;
}
public double getr(){
return r;
}
}
class yuanzhui extends circle
{
double h;
public yuanzhui(double h)
{this.h=h;} ///////为什么这里会有问题
public double gettiji(){
return (1/3*getarea()*h);
}
public double geth(){
return h;
}
public void seth(double H){
h=H;
}
}
class yuanzhu extends circle
{
double h;
public yuanzhu(double h)
{
this.h=h; ///////为什么这里会有问题
}
public double gettiji(){
return (getarea()*h);
}
public double geth(){
return h;
}
public void seth(double H){
h=H;
}
}
public class test{
public static void main(String args[])
{
yuanzhu yzu;
yzu=new yuanzhu(3.0);
yuanzhui yzui;
yzui=new yuanzhui(4.0);
System.out.print(yzu.gettiji());
System.out.print(yzui.gettiji());
}
}
import javax.swing.*;
class circle
{
public double r;
public circle(double r)
{
this.r=r;
}
public double getarea(){
return ((Math.PI)*r*r);
}
public double getperimeter(){
return (2*(Math.PI)*r);
}
public void setr(double R){
r=R;
}
public double getr(){
return r;
}
}
class yuanzhui extends circle
{
double h;
public yuanzhui(double h)
{this.h=h;} ///////为什么这里会有问题
public double gettiji(){
return (1/3*getarea()*h);
}
public double geth(){
return h;
}
public void seth(double H){
h=H;
}
}
class yuanzhu extends circle
{
double h;
public yuanzhu(double h)
{
this.h=h; ///////为什么这里会有问题
}
public double gettiji(){
return (getarea()*h);
}
public double geth(){
return h;
}
public void seth(double H){
h=H;
}
}
public class test{
public static void main(String args[])
{
yuanzhu yzu;
yzu=new yuanzhu(3.0);
yuanzhui yzui;
yzui=new yuanzhui(4.0);
System.out.print(yzu.gettiji());
System.out.print(yzui.gettiji());
}
}