Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

5. Create a Point structure for modeling points in the xy plane. Then, write a menu driven CH program that uses variables of type point

image text in transcribed
image text in transcribed
5. Create a Point structure for modeling points in the xy plane. Then, write a menu driven CH program that uses variables of type point to perform a variety of tasks involving points in the xy plane Points . Your program should be modular and must contain these functions: dist-this function will receive two Points and calculate and return the distance between the slope - this function will receive two Points and calculate and return the slope of the line connecting two Points, if it exists. This function should have a bool reference parameter that will return a value to the user indicating whether the slope is defined or not. midpoint - this function will receive two Points and calculate and return the midpoint of the line segment between two Points. equation - this function will receive two points and display the equation of the line passing through two Points collinear- this function will receive three points and determine if three points are collinear. If the points are collinear, this function should return true; otherwise, it should return false. readPt - this function will read a single point entered by the user in standard point "format" (for example "(4,3)) into a point variable and then return the point. showpt - this function will receive a Point and then display the point in standard point "format" (for example "(4,3)). Your function main should repeatedly display a menu of the above point manipulation tasks, read the user's task selection, and then call the appropriate function(s) from above to perform the selected task and display the result, until the user selects to exit the program. . . . Notes and suggestions: When the slope is not defined, function slope can return any value for the slope - the bool parameter will be set appropriately so that the calling function will know not to use the returned value Notes and suggestions: When the slope is not defined function slope can retum any value for the slope - the bool parameter will be set appropriately so that the calling function will know not to use the returned value. . c-a In function collinear, use function slope to determine its result. When checking for equality of two slopes, do not use the "=" operator on the float values - instead, determine if the absolute value of the float values are smaller than a threshold value (something small, like 0.000001). I Algebra Topics Review d-b Slope of the line between (a, b) and (c,d), m= provided a = c; slope undefined for vertical lines. Distance between (a, b) and (c,d). D = V(c-a) + (d - b) a + b + d Midpoint between (a, b) and (c,d): M = 2 The equation of a non-vertical line passing through(a, b) and (c,d) is given by y = mx + (6 - ma) where m is the slope of the line The equation of a vertical line passing through(a,b) and (a.d) is given by x = a where the slope of the line is undefined

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

find all matrices A (a) A = 13 (b) A + A = 213

Answered: 1 week ago