Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Rectangle {
- private double length;
- private double width;
- private String name;
- public Rectangle(double length, double width, String name){
- this.length = length;
- this.width = width;
- this.name = name;
- }
- public double radius() {
- return 0.5 * Math.sqrt(length * length + width * width);
- }
- public void resize (double x ,double y) {
- this.width = width * y;
- this.length = length * x;
- }
- public String toString() {
- return String.format("Rectangle %s, width: %f, length: %f", this.name, this.width, this.length);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment