interface BangunDatar
{
public double luas();
public double keliling();
}
class segitiga implements BangunDatar
{
double alas;
double tinggi;
public segitiga()
{
alas = 0;
tinggi = 0;
}
public segitiga(double a, double t)
{
alas = a;
tinggi = t;
}
public double GetAlas()
{
return alas;
}
public double GetTinggi()
{
return tinggi;
}
public void SetAlas(double a)
{
alas = a;
}
public void SetTinggi(double t)
{
tinggi = t;
}
public double luas()
{
return GetAlas()*GetTinggi()/2;
}
public double keliling()
{
return 3*GetAlas();
}
}
Langganan:
Posting Komentar (Atom)
0 komentar: