Question: 3 . Program 3 , Square, will implement a data type Square that represents squares with the x and y coordinates of their upper -
Program Square, will implement a data type Square that represents squares with the x and y coordinates of their upperleft corners and the length.The API should be as follows.Squaredouble x double y double lengthconstructordouble areareturns the area of the squaredouble perimeterreturns the perimeter of the squareboolean intersectsSquare bdoes this square intersect b Two squares would intersect if they share one or more common pointsboolean containsSquare bdoes this square contain bvoid drawdraw this square on standard drawingNote: The program should include a main method to test that it does the following. Instantiate a Square object whose upperleft corner coordinates and length are given as commandline arguments. It should print out the area and perimeter of the square. Prompt the user for a second squares upperleft corner coordinates and length, and indicate whether it intersects with the square specified earlier and also whether it contains the square specified earlier. Provide a popup window that displays the two squares.A sample run would be as follows.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
