Skip to content

Instantly share code, notes, and snippets.

@uncoded-ro
Created January 12, 2020 10:47
Show Gist options
  • Save uncoded-ro/7a43e17b255bca8c8c0a7f865a65ee13 to your computer and use it in GitHub Desktop.
Save uncoded-ro/7a43e17b255bca8c8c0a7f865a65ee13 to your computer and use it in GitHub Desktop.
package ro.virtualcampus.obiectgrafic;
public class Dreptunghi extends ObiectGrafic {
protected double lungime, latime;
public Dreptunghi(double lungime, double latime) {
super();
this.lungime = lungime;
this.latime = latime;
}
public Dreptunghi(double x, double y, double lungime, double latime) {
super(x, y);
this.lungime = lungime;
this.latime = latime;
}
@Override
public String toString() {
return "Dreptunghi [lungime=" + lungime + ", latime=" + latime
+ ", x=" + x + ", y=" + y + "]";
}
@Override
public double aria() {
return lungime * latime;
}
@Override
public double perimetrul() {
return 2 * (lungime + latime);
}
public double getLungime() {
return lungime;
}
public void setLungime(double lungime) {
this.lungime = lungime;
}
public double getLatime() {
return latime;
}
public void setLatime(double latime) {
this.latime = latime;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment