class Box
{
// Instance Variables
double length ;
double width ;
double height ;
// Constructors
public Box ( double side )
{
width = side ;
height = side ;
length = side ;
}
public Box(double length, double height, double width)
{
this.length=length;
this.width=width;
this.height=height;
}
// Methods
double calculate()
{
return 2 * ( width * height +
width * length +
height * length ) ;
}
double volume(){
return (width*length*height);
}
public String toString(){
return ("sunolikh epifaneia: " + calculate() + " ogkos: " + volume() );
}
}

class MyBox extends Box
{
  
    public MyBox(double side)
    {super(side,side,side);
        if(side<=0){
            System.out.println("lathos dedomena");}
   
    }
double calculate()
{
return 2 * ( width * height +
width * length +
height * length ) ;
}
double volume(){
return (width*length*height);
}
    
public String toString(){
return ("sunolikh epifaneia: " + calculate() + "ogkos: " + volume() );
}
}

class Spirtokouto extends Box
{
   double weight;
 

    public Spirtokouto(double wid, double len, double heig, double wei)
    {
        super(len,heig,wid);
        weight=wei;
    }
public String toString(){
return ("sunolikh epifaneia: " + calculate() + " ogkos: " + volume() + " varos: " + weight);
}
}
 
public class RunMe
{
public static void main(String args[]){
Box koutaki=new Box(2.5, 3.0, 4.0);
MyBox kuvaki=new MyBox(3.0);
Spirtokouto sp= new Spirtokouto(2.0,4.0,3.0,10.0);
System.out.println(koutaki.toString());
System.out.println(kuvaki.toString());
System.out.println(sp.toString());
}
}