Match assignment output

This commit is contained in:
HeshamTB 2020-08-31 16:03:51 +03:00
parent 732124669c
commit 7a332d5f6a
Signed by: Hesham
GPG Key ID: 74876157D199B09E
3 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ public class Circle extends _Point {
public double getCircumfrence() { return 2*Math.PI*this.radius; }
public String toString() {
String format = "%sCircle's radius = %f ,area = %f, circumfrence = %f\n";
String format = "%sCircle's radius = %.2f ,area = %.2f, circumfrence = %.2f\n";
return String.format(format, super.toString(), getRadius(), getArea(), getCircumfrence());
}

View File

@ -28,7 +28,7 @@ public class Cylinder extends Circle {
public double getHeight(){ return this.height; }
public String toString(){
String format = "%sCylinder's height = %f ,Surface area = %f , Volume = %f";
String format = "%sCylinder's height = %.2f ,Surface area = %.2f , Volume = %.2f";
return String.format(format, super.toString(), getHeight(), getSurfaceArea(), getVolume());
}

View File

@ -28,7 +28,7 @@ public class _Rectangle extends _Point {
public double getCircumfrence(){ return 2*(this.width+this.height); }
public String toString() {
return String.format("%s, Height %f, Width %f, Area %f, Circumfrence %f",
return String.format("%sRectangle's Height %.2f, Width %.2f, Area %.2f, Circumfrence %.2f",
super.toString(), getHeight(), getWidth(), getArea(), getCircumfrence());
}
}