Question: C++ Coding - Class # 8 B option: (The best grade is an 90%) Create a class to store Distance . Store the data points
C++ Coding - Class # 8

B option: (The best grade is an 90%) Create a class to store Distance . Store the data points x1, yl, x2, y2 in the private section of the class as doubles .Provide public member functions to set the values into the class .Provide a member function called GetDistance that returns the distance between the points Example of using the class void main( l/ create a Distance object Distance Double I/ set the values into the object; a.setx1(12.0) a.sety1 (20.0) a.setx2(40.0) a.sety2(50.0) length-a.GetDistance); cout at the top of your source code file to access these functions A option: (The best grade is a 100%) . Add a 4 parameter constructor that allows you to enter the data points when the object is created: . Provide public member functions to get the values from the class Distance a(2.0, 20.0, 20.0, 50.0); l/ create and set the values of a distance object cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
