Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

4. Does every individual feel included, accepted, and understood?

Answered: 1 week ago