subject

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();

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:10
What a backup plan that you have created in a event you encounter a situation
Answers: 2
question
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
question
Computers and Technology, 23.06.2019 12:00
If you're using an existing powerpoint presentation that will receive new slides based on a word outline, select the a. slide that will appear after the new slides. b. first slide in the presentation. c. slide that will appear before the new slides. d. last slide in the presentation.
Answers: 2
question
Computers and Technology, 23.06.2019 21:30
Enzo’s balance sheet for the month of july is shown. enzo’s balance sheet (july 2013) assets liabilities cash $600 credit card $4,000 investments $500 student loan $2,500 house $120,000 mortgage $80,000 car $6,000 car loan $2,000 total $127,100 total $88,500 which expression finds enzo’s net worth?
Answers: 1
You know the right answer?
You will create a program that will take in the values for two points (x1 , x2) and (y1, y2) to find...
Questions
question
Chemistry, 23.11.2020 06:30
question
English, 23.11.2020 06:30
question
Mathematics, 23.11.2020 06:30
question
Arts, 23.11.2020 06:30
Questions on the website: 13722363