Class Rectangle: area and perimeter
Java
Easy
classes
Task «Class Rectangle: area and perimeter»
Create a class Rectangle with fields width and height. Implement a method for calculating the area and a method for calculating the perimeter. In main, read two integers — the width and height of the rectangle. Create a Rectangle object, output the area and perimeter separated by a space.
Input Format
Two integers separated by a space: the width and height of the rectangle (1 ≤ width, height ≤ 1000).
Output Format
Two integers separated by a space: the area and perimeter of a rectangle.
Examples
Example 1
INPUT
7 4
OUTPUT
28 22
Example 2
INPUT
5 5
OUTPUT
25 20
main.java