A square is an equilateral and equiangular polygon by default. Implement these properties of a square to design a class named Square. The class contains a private data field named x and y that store the respective coordinates of the square. All data fields inside the class are private, therefore the class must contain accessor and mutator methods. Calculate the area and perimeter of the square using two different methods. Write a test program to create two squares with the value - (4,5) where 10 refers to the number of sides and 5 refers to the length of each side - (4, 2, 8, 2.8) where 4 is the number of sides, 2 is the length of each side, 8 & 2.8 are (x.y) coordinates of the square on a plane. Display the area and perimeter of each square.

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

urgennt pls

PLEASE WRITE IN JAVA.
Please answer asap because I only have 1 hour !!!!!
A square is an equilateral and equiangular polygon by default. Implement these properties of a square to design a class
named Square. The class contains a private data field named x and y that store the respective coordinates of the square.
All data fields inside the class are private, therefore the class must contain accessor and mutator methods. Calculate the
area and perimeter of the square using two different methods. Write a test program to create two squares with the value
- (4,5) where 10 refers to the number of sides and 5 refers to the length of each side
- (4, 2, 8, 2.8) where 4 is the number of sides, 2 is the length of each side, 8 & 2.8 are (x.y) coordinates of the square on a
plane.
Display the area and perimeter of each square.
Transcribed Image Text:PLEASE WRITE IN JAVA. Please answer asap because I only have 1 hour !!!!! A square is an equilateral and equiangular polygon by default. Implement these properties of a square to design a class named Square. The class contains a private data field named x and y that store the respective coordinates of the square. All data fields inside the class are private, therefore the class must contain accessor and mutator methods. Calculate the area and perimeter of the square using two different methods. Write a test program to create two squares with the value - (4,5) where 10 refers to the number of sides and 5 refers to the length of each side - (4, 2, 8, 2.8) where 4 is the number of sides, 2 is the length of each side, 8 & 2.8 are (x.y) coordinates of the square on a plane. Display the area and perimeter of each square.
Expert Solution
steps

Step by step

Solved in 2 steps

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