Topical Information

This program will continue to provide you with practice with using standard library functions, making elegant use of character input's amazing properties, branching, and looping. There are also options for using functions to clean up the program/ease development and using more advanced input features.

Background Information

You remember your old friend the Cartesian plane, right? Well, then you'll also remember how to determine the distance between any two points in that plane or how to find a third point which is equidistant from each of two points in that plane.

Program Information

Write a program that helps the user calculate both the distance between two points in the 2D Cartesian plane and the midpoint of the line segment those two points define. Try to make your results as readable as possible.

Oh, btw, the exact level of the user may be a bit variable. The client said they want to use this program anywhere in their K-12 school system. So, you'll need to account for the possibility that the user may use appropriate notation during entry or might not. They may leave off one or both parentheses or leave out the comma between the two coordinates. If they do, don't worry about it, but print a little reminder message to tell them what notation they messed up on.

So, to enter the point (3,-4), the user should be able to enter any of: (3,-4), 3,-4), (3,-4, (3 -4), 3,-4, 3 -4), (3 -4, or even 3 -4. Only the first would be quiet, however, the others would generate 1, 2, or even 3 warning/reminder messages about missing notation.

As an example, you might have the program interaction look something like (the parts in this color are typed by the user):

$ ./pointcalcinp.out

                 Welcome to the 2D Point Program!!!

Where is your first point?  3.4 12.2)

    You were missing the open parenthesis before the x coordinate!
    You were missing the comma to separate coordinates!

    Please use proper notation...

Where is your second point?  (13.4, 12.2

    You were missing the close parenthesis after the y coordinate!

    Please use proper notation...

Thank you!!  Calculating...  Done.

(3.4, 12.2) is 10 units away from (13.4, 12.2).

The midpoint of the line segment from (3.4, 12.2) to
(13.4, 12.2) is (8.4, 12.2).

Thank you for using the 2PP!!

Endeavor to have a day...


This assignment is (Level 4).