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.

  1. Complete the Point constructor.
  2. Write properties for x, and y values in Point Class.
  3. Complete the constructors of the class square.
    1. 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.
    2. The square has equal length and width.
    3. It has four 90 degree angles (equal diagonal).
  4. Write an indexer for Square to only get its point.
  5. Write a public method that returns its area.

Write a public method that return the perimeter of the square.

Solve this problem using MS Visual studio and write test project to

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 1

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!