Class: SquareCreate a class called "Square", which is inherited from“TwoDimensionShape” class. The "Square" class is used to calculate theArea and the Perimeter of square shapes when their side-length is given, or in contrast,finding the side-length of the square when the Area or the Perimeter of the square is given.The specifications of this class are below. Data Members (Attributes): All are private. sideLength: the sidelight (L) of the square. Methods/Operations/Getters/Setters: Default Constructor: when creating an object this constructor must set the side-length of the square by calling the method setSideLength(). Also, this constructor willcall the findArea() and the findPerimeter() in addition to summaryPrint() to calculateand print all needed information. User-Defined Constructor: when creating an object this constructor shouldfind the side-length of the square by calling the method findSquareSideLength()and pass the Area or the Perimeter of the square to it. Finally, this constructorshould call the summaryPrint() method to print all information on the screen Method setSideLength(): to set the side-length (L) of the square, by the keyboard.Entered values must be validated, otherwise, repetition occurs (must be re-enteredagain). Method getSideLength(): to get the side-length (L) of the square. Method findArea(): must override the abstract method, findArea(), to calculate thesquare’s area. Method findPerimeter(): must override the abstract method, findPerimeter(), tocalculate the square’s perimeter. Method findSquareSideLength(): is used to calculate the side-length of the square bygiven the Area or the Perimeter value through the user-defined constructor. Method summaryPrint(): must override the abstract method, summaryPrint(), to printall information on the screen.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here