Match assignment output
This commit is contained in:
parent
732124669c
commit
7a332d5f6a
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user