Question: Write a class called Point . The class should have two private float data members x and y . Write two constructors: one default constructor

Write a class called Point. The class should have two private float data members x and y. Write two constructors: one default constructor that initialises the data members to 0, and one that takes two arguments and uses them to initialise the two data members. Also write the following member functions:

void SetXY (float, float) float GetX () assigns the two arguments to the two data members returns the value of the x data member float GetY () returns the value of the y data member void Move (float, float) moves the point by the specified amount

void Display () displays the values of the arguments

Write a main function that allows the user to enter the x and y coordinates of two Point objects and then calculates and prints the equation of the straight line that joins the two points. A straight line is defined by the equation y = mx + c, so the values of m and c can be calculated as follows:

m = (y2 y1) / (x2 x1)

c=y1 - mx1

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!