eolymp
bolt
Try our new interface for solving problems
Problems

Java Inheritance Rectangle Square

published at 4/4/24, 8:20:11 am

class Rectangle { private int a, b;

Rectangle(int a, int b) { this.a=a; this.b=b; }

public int Area() { return this.a*this.b; }

public int Perimeter() { return 2*(this.a+this.b); } }

class Square extends Rectangle { Square(int a) { super(a,a); } }