Package it.unimi.di.prog2.s17
Class Square
java.lang.Object
it.unimi.di.prog2.s17.Rectangle
it.unimi.di.prog2.s17.Square
A mutable class representing a square with integer valued base.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Square
public Square(int base) Creates a rectangle of given base and height.- Parameters:
base
- the base of the rectangle.
-
-
Method Details
-
base
public void base(int base) Sets the base of the square.- Overrides:
base
in classRectangle
- Parameters:
base
- the new base of the square.- Throws:
IllegalArgumentException
- if base is negative.
-
height
public void height(int height) Sets the height of the square.- Overrides:
height
in classRectangle
- Parameters:
height
- the new height of the square.- Throws:
IllegalArgumentException
- if height is negative.
-
toString
-