Java Inheritance Rectangle Square
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Implement a class Rectangle.
Implement a class Square that extends Rectangle.
class Rectangle { private int a, b; // private variable Rectangle(int a, int b) // Constructor public int Area() // return area public int Perimeter() // return perimeter } class Square extends Rectangle { Square(int a) // Constructor }
Input
Each line contains one of two figures in the next format:
Rectangle a b
Square a
Here a and b are sides of rectangle. In the case of a square a is its side.
Output
For each figure print in one line its area and perimeter.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 49%