Question: In visual studio code, code the following prompt: Deliverable: problem 2 functions.h and problem 2 functions.cpp - Write a function named Distance that takes four

In visual studio code, code the following prompt:
Deliverable: problem2functions.h and problem2functions.cpp
-Write a function named Distance that takes four double arguments for the x and y
coordinates of two points (x1,y1,x2,y2),and returns the distance between those points
as a double. If the function is called with the coordinates of one point only, the second
points coordinates should default to the origin (0,0).
Recall, the formula to compute the distance, d,between two points is:
=(21)
2
+(21)
2
Example calls:
-Distance(3,4)should return 5(the distance between the point (3,4)and
the point (0,0)).
-Write a function named OnCircle that takes the x and y coordinates of the center of a
circle as the first two parameters, the radius of the circle as the third parameter, and the
x and y coordinates of a point as the fourth and fifth parameters (all doubles).The
function should return -1if the point lies inside of the circle, 0if the point lies on the
circle, and 1if the point lies outside of the circle.
Example calls:
-OnCircle(0,0,5,1,1)should return -1because the point (1,1)lies inside
the circle centered at (0,0)with radius 5.
-Write a function named OnLine that takes the x and y coordinates (all doubles)of three
points (x1,y1,x2,y2,x3,y3).The function should return true if the three points lie on a
straight line, and false if they do not.
Example calls:
-OnLine(0,0,1,3,2,6)should return true because the three points (0,0)
(1,3)and (2,6)lie on a straight line
(important):
-All three function prototypes should be included in problem2functions.h
-All three functions should be implemented in problem2functions.cpp
A makefile has been included below,
To run the tests provided, you should type the following:
make testDistance
make testOnCircle
make testOnLine
Makefile:
flags =-std=c++17-Wall -I .
problem2functions.o : problem2functions.cpp problem2functions.h
g++$(flags)-c $<
testDistance : testDistance.cpp problem2functions.o
g++$(flags)$^-o $@
./$@
testOnCircle : testOnCircle.cpp problem2functions.o
g++$(flags)$^-o $@
./$@
testOnLine : testOnLine.cpp problem2functions.o
g++$(flags)$^-o $@
./$@

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 Programming Questions!