Class: Square  Create a class called "Square", which is inherited from “TwoDimensionShape” class. The "Square" class is used to calculate the Area 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 will call the findArea() and the findPerimeter() in addition to summaryPrint() to calculate and print all needed information.  User-Defined Constructor: when creating an object this constructor should find 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 constructor should 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-entered again).  Method getSideLength(): to get the side-length (L) of the square.  Method findArea(): must override the abstract method, findArea(), to calculate the square’s area.  Method findPerimeter(): must override the abstract method, findPerimeter(), to calculate the square’s perimeter.  Method findSquareSideLength(): is used to calculate the side-length of the square by given the Area or the Perimeter value through the user-defined constructor.  Method summaryPrint(): must override the abstract method, summaryPrint(), to print all information on the screen.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Class: Square 
Create a class called "Square", which is inherited from
“TwoDimensionShape” class. The "Square" class is used to calculate the
Area 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 will
call the findArea() and the findPerimeter() in addition to summaryPrint() to calculate
and print all needed information.
 User-Defined Constructor: when creating an object this constructor should
find 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 constructor
should 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-entered
again).
 Method getSideLength(): to get the side-length (L) of the square.
 Method findArea(): must override the abstract method, findArea(), to calculate the
square’s area.
 Method findPerimeter(): must override the abstract method, findPerimeter(), to
calculate the square’s perimeter.
 Method findSquareSideLength(): is used to calculate the side-length of the square by
given the Area or the Perimeter value through the user-defined constructor.
 Method summaryPrint(): must override the abstract method, summaryPrint(), to print
all information on the screen.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY