Question: 1. Create a square class whose center is at 100,100. All of its sides are 50 long. A. It should have fields for the coordinates

1. Create a square class whose center is at 100,100. All of its sides are 50 long. A. It should have fields for the coordinates of the center, each corner and for the length of a side.

B. In the constructor, values are assigned for the center coordinates and the length of a side as given above. Other variables are initialized at zero

C. It should have two methods:

-One to calculate the coordinates for all 4 corners and assign them th the appropriate variables.

-One to display the results. The display will llok something like this:

This sides of this square are 50 and its center coordinates are 100,100.

Here are the coordinates of the four corners.

Top left: 75,75

Top right: 125,75

Bottom left: 75,125

Bottom rightL 125,125

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!