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 17:30
1. before plugging in a new device to a computer you should unplug all other devices turn off the computer turn on the computer 2. many of the maintenance tools for a computer can be found in the control panel under administrative tools display personalization
Answers: 1
question
Computers and Technology, 23.06.2019 06:40
What are the three uses of a screw?
Answers: 2
question
Computers and Technology, 24.06.2019 17:40
When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. this can be done by normalizing to values between 0 and 1, or throwing away outliers. for this program, adjust the values by subtracting the smallest value from all the values. the input begins with an integer indicating the number of integers that follow. ex: if the input is 5 30 50 10 70 65, the output is: 20 40 0 60 55
Answers: 1
question
Computers and Technology, 25.06.2019 06:20
If you want to change the speed of a layer's horizontal scrolling, what should you change? a. the x coefficient b. the y coefficient c. the virtual width d. the order of the game's layers select the best answer from the choices provided
Answers: 2
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
Mathematics, 28.01.2020 17:03
question
Mathematics, 28.01.2020 17:03
Questions on the website: 13722361