-
-
Save uncoded-ro/7a43e17b255bca8c8c0a7f865a65ee13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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