Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program uses the topics discussed in Chapter 3 , input / output interactivity, formatting output, and usingthe cmath library. Write a program that asks

This program uses the topics discussed in Chapter 3,input/output interactivity, formatting output, and usingthe cmath library. Write a program that asks the user toenter the x and y coordinates of two points. That is,(x1,y1) and (x2, y2). The program should: Find the distance, r, between the two points usingthe Pythagorean Theorem. Find the slope, m, of the line that joins the two points. Find the midpoint of the line connecting these two points. Find the equation of the line in standard form.All functions are to be from the cmath library. Use setprecision(4) with fixedpoint notation. Use float or double data types. Do not use the same value for x1and x2. This will cause the compiler to divide by zero. Formulas to be used are: Distance = r = SQRT ((x2-x1)2+(y2-y1)2) Midpoint =((x1+x2)/2.0,(y1+y2)/2.0) Slope = m =(y2-y1)/(x2-x1) Standard Form: y = mx mx1+ y1Your output should look like this:Enter the value of x1:Enter the value of x2:Enter the value of y1:Enter the value of y2:The distance from these two points is:The midpoint of the line joining these two points is:The equation of the line in standard form isThis program uses the topics discussed in Chapter 3,
put/output interactivity, formatting output, and using
ne cmath library. Write a program that asks the user to
nter the x and y coordinates of two points. That is,
(1,y1) and (x2,y2). The program should:
Find the distance, r, between the two points using
the Pythagorean Theorem.
Find the slope, m, of the line that joins the two points.
Find the midpoint of the line connecting these two points.
Find the equation of the line in standard form.
All functions are to be from the cmath library. Use setprecision(4) with fi
oint notation. Use float or double data types. Do not use the same value fo
nd x2. This will cause the compiler to divide by zero. Formulas to be used a
, Distance =r?S=QRT((x2-x1)2+(y2-y1)2)
Midpoint =(x1+x22.0,y1+y22.0)
Slope =m=y2-y1x2-x1
Standard Form: y=mx-mx1+y1
Your output should look like this:
Enter the value of x1 :
Enter the value of x2 :
Enter the value of y1 :
Enter the value of y2 :
The distance from these two points is:
The midpoint of the line joining these two points is:
The equation of the line in standard form is:
image text in transcribed

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

List and briefly define four application areas for wireless LANs.

Answered: 1 week ago

Question

What are the four types of initiatives suggested in this chapter?

Answered: 1 week ago

Question

When is it appropriate to use a root cause analysis

Answered: 1 week ago