Lesson 16

Part II (Continuation of Programming, continued)

How can we find the midpoint of a line segment? Well, it is not too difficult if we know the end points of the segment. This is how we do it:

1. Displaying the Midpoint Coordinates using PrintNatural

4342345

2. Getting Input from the User

We need to ask the user to input the endpoints of their line segment as ordered pairs (x, y).

3. Calculating and Displaying the Midpoint


Part II


Practice Exercises

  1. This practice set may not be easy, but it will definitely be interesting.
  2. We know that the midpoint of a line segment divides the line segment into two equal parts. What if we want to divide it into four equal parts?
  3. Modify your Midpoint program to find the ¼ point, the ½ point (this is already done – the midpoint) and the ¾ point.
  4. After you have finished, run your program using the coordinates: (-4, 2) and (8, 10). Your output should look like:
  5. Run your program again using the coordinates: (2, -6) and (-8, 14).
  6. With your output window resized, get a screen capture. Paste it into your Lesson 16 document (under a title of PART II).