Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

m= Programming Homework 1. The slope m of the line between the two points (x1, yi) and (x2, ya) is given by the formula Ayy,

image text in transcribed
image text in transcribed
m= Programming Homework 1. The slope m of the line between the two points (x1, yi) and (x2, ya) is given by the formula Ayy, - Ax Write a program that will ask the user for the coordinates of two points and do the following: Determine if the two points form a line. Detect if the line is horizontal and alert the user. Detect if the line is vertical and alert the user. Calculate the slope of the line segment connecting em, if not 0 or undefined. Use double-type variables for storing the coordinates and calculations made from them. Sample Run: Enter the coordinates of point 1(x, y): 38 Enter the coordinates of point 2 (x, y): 38 Alert! These points do not form a line. Sample Run: Enter the coordinates of point 1(x,y): 3 3 Enter the coordinates of point 2 (x,y): 78 The slope of the line is 1.25 Sample Run: Enter the coordinates of point 1(x, y): -29 Enter the coordinates of point 2 (x,y): 49 Alert! The line is horizontal Sample Run: Enter the coordinates of point 1 (x,y): 5-6 Enter the coordinates of point 2 (x,y): 59 Alert! The line is vertical. Next modify the program to print the equation of the line in slope-intercept form ( y = mx + b). Use the appropriate "y=" and "x =" for horizontal and vertical lines, respectively. Sample Run: Enter the coordinates of point 1(x, y): 35 Enter the coordinates of point 2 (x, y): 58 The slope of the line is 1.50 The slope-intercept form is y = 1.50x + 50 Hint: To format a variable to two decimal places, include the header file iomanip and use these cout class manipulators: cout

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

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions