Computers and Technology

You will create a program that will take in the values for two points (x1 , x2) and (y1, y2) to find the slope of a line that contains those two points. I have provided the pseudocode for you below. All you need to do is translate the pseudocode to a Python program that will run and output the correct slope.

You can test your program by entering the following two point values: (x1 , y1) –> (32, 22) and (x2 , y2) –> (53, 36). Your slope should be 2/3.

PROCEDURE getCoordinates ()
{
<< global variables predefined in starter code >>

DISPLAY (What is the value of x1?)

x1 ← INPUT()

DISPLAY (What is the value of y1?)

y1 ← INPUT()

DISPLAY (What is the value of x2?)

x2 ← INPUT()

DISPLAY (What is the value of y2?)

y2 ← INPUT()

}

PROCEDURE getSlope()

{

<< global variables predefined in starter code >>

numerator ← y2 - y1

denominator ← x2 - x1

getHighestMultiple()

numerator ← numerator / highestMultiple

denominator ← denominator / highestMultiple

DISPLAY(β€œSlope is ” + numerator + β€œ/” + denominator)

}

PROCEDURE getHighestMultiple()

{

<< global variables predefined in starter code >>

temp ← numerator

while (temp > 1)

{

IF((numerator MOD temp == 0) and (denominator MOD temp == 0))

{

highestMultiple ← temp

}

temp ← temp - 1

}

}

getCoordinates();
getSlope();

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 21:00, kkpsmith
Alcohol’s affects on the cornea and lens of the eye make it more difficult
Answers: 1
image
Computers and Technology, 24.06.2019 10:50, latresyn
In 2009 to 2010, how many social network users were reported as being victims of online abuse? a. 1 in 10 b. 100% c.1 in 100 d. 50%
Answers: 2
image
Computers and Technology, 24.06.2019 15:30, pineapplefun
During the software planning process, rick, a project manager, finds that his team has made an incorrect estimation of funds. what kind of risk has rick identified? rick has identified a risk.
Answers: 1
image
Computers and Technology, 24.06.2019 19:30, sipstick971
Dtp allows you to manipulate text boxes in the following ways. more than 1 answer. a. move them b. rotate them c. resize them d. all of the above e. none of the above
Answers: 1
Do you know the correct answer?
You will create a program that will take in the values for two points (x1 , x2) and (y1, y2) to find...

Questions in other subjects:

Konu
Mathematics, 01.09.2021 22:00
Konu
Chemistry, 01.09.2021 22:00
Konu
Mathematics, 01.09.2021 22:00
Konu
Mathematics, 01.09.2021 22:00