Question
Solve this problem using MS Visual studio and write test project to validate the point and Square class. Problem three: The following application implements a
Solve this problem using MS Visual studio and write test project to validate the point and Square class.
Problem three:
The following application implements a set of related classes. The class Point represents a point in the Cartesian space. The Class Square represents square shape in Cartesian space.
- Complete the Point constructor.
- Write properties for x, and y values in Point Class.
- Complete the constructors of the class square.
- The order of points in the square is important. Thus, we will consider that the first point in the list represents the upper left point and we move counter clock wise. If we have two points in left with same level, we use one of them. A sample square in Cartesian space is shown in Figure P2.
- The square has equal length and width.
- It has four 90 degree angles (equal diagonal).
- Write an indexer for Square to only get its point.
- Write a public method that returns its area.
Write a public method that return the perimeter of the square.
Figure P2. A sample square in Cartesian space and the order of it points.
Public Class Point{
private double x;
private double y;
public Point()
{
x = 0;
y = 0;
}
Public Point( double xvalue, )
{
}
}
Public Class Square
{
private int numberofPoints;
Point [] squarePoints;
Public Square()
{
squarePoints = new Point[4];
squarePoints [0] = new ..;
squarePoints [1] = new ..;
squarePoints [2] = new ;
squarePoints [3] = new ..;
}
Public Square (..)
{
// initialization without validation will be considered correct.
// validation for point orientation as described in the problem will have
// three points bonus.
}
Point 3 Y axis Point 2 Point 0 (0,0) X axis Point 1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started