Homework 2

 

If the user provides two points (x1,y1) and (x2,y2) on a straight line, the line’s slope can be calculated using the formula (y2-y1) / (x2-x1). 

-         Use RAPTOR to design and test an algorithm that gets the two points from the user and prints the slope in a meaningful way. 

-         If the slope does not exist because the denominator is zero, the algorithm should print an error message to that effect. 

-         Make sure your solution also prints your name and alpha before any work is done. 

Turn In: A screen dump of the RAPTOR flowchart screen and a screen dump of the RAPTOR Master Console window for each of the following cases. 

1.      A run in which the user elects to enter (-2, -5) and (7, 9) as values for the two points (x1,y1) and (x2,y2), and a slope is displayed, and

2.      A run in which the user elects to enter (-2, -5) and (-2, 9) as values for the two points (x1,y1) and (x2,y2) in which case the error message is displayed.

Note: You can capture an image in Windows by selecting the window you want to copy, press <Crtl><Alt><Prnt Scrn> simultaneously, and then paste the image into a Word document.