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
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