Question: C PROGRAMME Write a C program to carcutate the distance, mupomt and slope between two endpoints. Your program should satisfy the following requirements a. Provide

C PROGRAMME
Write a C program to carcutate the distance, mupomt and slope between two endpoints. Your program should satisfy the following requirements a. Provide the user with a menu that offers the following options; calculate distance, calculate midpoint and calculate slope. b. Prompt the user to enter two endpoints. Each point is defined by X- and y- coordinates. For example point A (x1, yl) and point B(x2, y2) c. Beside function main(), the program needs to define three (3) user-defined functions as described in Table 6. The sample output of this program is shown in Figure 5. Table 6 Function Description calDistance This function calculates the distance between two endpoints distance = V(x2 - x2)2 + (y2 - y)2 This function should accept two endpoints as arguments and return distance value. calMidpoint This function calculates the midpoint between two endpoints X + x1 Y2 + yi Xmid -.mid 2 2 This function should accept two endpoints and midpoints as arguments and returns no value. calSlope This function calculates the slope between two endpoints. Y2 - 1 slope = X - x This function accepts two endpoints as arguments and return slope value. Please enter your option by entering the number 1. Calculate Distance 2. Calculate Midpoint 3. Calculate Slope 4. Exit Option: 1 Enter the first point xl, yi: 1.0 3.0 Enter the second point x2, y2: 5.0 6.0 Distance between the two points is 5.00 Please enter your option by entering the number 1. Calculate Distance 2. Calculate Midpoint 4. Calculate slope 4. Exit Option: 4 Thank you!!! Figure 5: sample output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
