Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
553 B
0
Indexable
Never
public class Enkapsulasi {

    private int alas, tinggi;

    private double LuasSegitiga;

    public void setAlas(int alas){
        this.alas = alas;
    }

    public int getAlas(){
        return alas;
    }

    public void setTinggi(int tinggi){
        this.tinggi = tinggi;
    }

    public int getTinggi(){
        return tinggi;
    }

    public void setLuasSegitiga(int alas, int tinggi){
        LuasSegitiga = 0.5 * (double) (alas + tinggi);
    }
    public double getLuasSegitiga() {return LuasSegitiga;}
}