Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Prompt the user to enter in 3 points on a standard Cartesian coordinate plane. You can assume the user will enter these values as floating
Prompt the user to enter in 3 points on a standard Cartesian coordinate plane. You can assume the user will enter these values as floating point numbers. Compute the distance between each of two points - so you will be computing 3 distance values. Use the distance formula to do this (x1-x2)2 (y1-y2)2 0.5 note that you can raise a value to the 0.5 power to compute the square root, or you can use the sqrt0 function in the math module- your choice! Report the distance to the user of each side, rounded to 2 decimal places Next, determine if the three points could form a valid triangle. You can assume that the triangle is valid by checking the following (a) Side 1 Side 2 must be longer than Side 3 (b) Side 2 Side 3 must be longer than Side 1 (c) Side 3 + Side 1 must be longer than Side 2 Here are some sample runnings of the program, as well as a diagram that will help you to visualize the problem 0,100 100,100 0,0 100,0 50,50 110,100 75,25 0,0 Valid and Invalid Triangles RUN #1 Valid Triangle Tester Enter Point #1 -x position: 0 Enter Point #1 - y position: 0 Enter Point #2 -x position: 0 Enter Point #2-y position: 100 Enter Point #3 -x position : 100 Enter Point #3 -y position: 0 The length of each side of your test shape is: Side 1: 100.00 Side 2: 141.42 Side 3: 100.00 This is a valid triangle! RUN #2 Valid Triangle Tester Enter Point #1 -x position: 0 Enter Point #1 -y position: 0 Enter Point #2 -x position: 75 The length of each side of your test shape is: Side 1: 100.00 Side 2: 141.42 Side 3: 100.00 This is a valid triangle! RUN #2 Valid Triangle Tester Enter Point #1 -x position: 0 Enter Point #1 - y position: 0 Enter Point #2 - x position: 75 Enter Point #2 - y position: 25 Enter Point #3 -x position : 110 Enter Point #3 - y position: 100 The length of each side of your test shape is: Side 1: 79.06 Side 2: 82.76 Side 3: 148.66 This is a valid triangle! RUN #3 Valid Triangle Tester Enter Point #1 -x position: 0 Enter Point #1 - y position: 0 Enter Point #2 - x position: 50 Enter Point #2 - y position: 50 Enter Point #3 -x position : 100 Enter Point #3 - y position : 100 The length of each side of your test shape is: Side 1: 70.71 Side 2: 70.71 Side 3: 141.42 This is not a valid triangle Comment your source code and describe your code to someone who may be viewing it for the first time. Also include your name, the date, your class section and the name of your program at the top of your file
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started