Anson of Sanctuary
Well-known member
- Registriert
- 14 April 2001
- Beiträge
- 1.713
- Punkte Reaktionen
- 0
Steht doch da: Java ... Was höre ich ? Du willst mehr ? SOllst du bekommen. Das ist eine (stark) objektorientierte Programmiersprache.
class Cube extends Rectangle
{
private int heigth;
private int volume;
int getHeigth()
{return heigth;}
void setHeigth(int heigth)
{this.heigth = heigth;}
Cube()
{
setWidth(1);
setLength(1);
setHeigth(1);
}
Cube(int width, int length, int heigth)
{
setWidth(width);
setLength(length);
setHeigth(heigth);
}
int getVolume()
{
return getWidth()*getLength()*getHeigth();
}
int getArea()
{
volume = 2*( getWidth()*getLength()
+getWidth()*getHeigth()
+getHeigth()*getLength());
return area;
}
}
class Cube extends Rectangle
{
private int heigth;
private int volume;
int getHeigth()
{return heigth;}
void setHeigth(int heigth)
{this.heigth = heigth;}
Cube()
{
setWidth(1);
setLength(1);
setHeigth(1);
}
Cube(int width, int length, int heigth)
{
setWidth(width);
setLength(length);
setHeigth(heigth);
}
int getVolume()
{
return getWidth()*getLength()*getHeigth();
}
int getArea()
{
volume = 2*( getWidth()*getLength()
+getWidth()*getHeigth()
+getHeigth()*getLength());
return area;
}
}