Homework_1

[Variables. Arithemtic. Input and Output. The if Statement. Comparing Numbers.]

Write a program that prompts the user to enter points using the keyboard. In all tasks you have a coordinate system on the plane and all points are defined with their coordinates in this coordinate system. Triangles are defined by their vertexes; circles are defined by their centers (which are points) and their radius (which are numbers). Make the calculations and print out the results. Your program must be tested with an example given after every task. Also it can work with arbitrary input data.

The number of your particular task is the value of the expression faculty_number%25 (remainder of integer division; f mod 25).

Model task: Enter a triangle and calculate the length of its minimal side.
Example: (2, 3); (5, 2.5); (1, -1)
Solution


0. Enter a triangle and calculate its area. Print out "too small" when the area is less than 1.
http://en.wikipedia.org/wiki/Triangle
Example: (2, 3); (5, 2.5); (1, -1)

1. Enter a convex quadrilateral with vertexes in different quadrants and calculate its area. Print out "too small" when the area is less than 1.
http://en.wikipedia.org/wiki/Quadrilateral
Example: (2, 3); (-5, 2.5); (-1,-1); (2, 3.5)

2. Enter a triangle and calculate its perimeter. Print out "too small" when the perimeter is less than 1.
http://en.wikipedia.org/wiki/Triangle
Example: (-2,3); (5,4); (1,0)

3. Enter a triangle and calculate the radius of its circumscribed circle. Print out "too small" when the radius is less than 1.
http://en.wikipedia.org/wiki/Circumscribed
Example: (2,2.1); (-3,2.5); (0,0)

4. Enter a triangle and calculate the radius of its inscribed circle. Print out "too small" when the radius is less than 1.
http://en.wikipedia.org/wiki/Inscribed
Example: (2,2.1); (-3,2.5); (0,0)

5. Enter a triangle and determine its type - acute-angled, obtuse-angled or right-angled.
http://en.wikipedia.org/wiki/Angle#Types_of_angles
Example: (0,0); (25,0); (0,50)

6. Enter a triangle and calculate the bisector length of its maximal angle.
http://en.wikipedia.org/wiki/Angle_bisector#Angle_bisector
Example: (3,1); (-1,2.5); (0,0.5)

7. Enter a triangle and calculate the sine of its maximal angle.
http://en.wikipedia.org/wiki/Sine
Example: (-2.0,4.0); (-3.0,2.5); (0.0,2.0)

8. Enter  a triangle and calculate the cosine of its minimal angle.
http://en.wikipedia.org/wiki/Sine
Example: (-2.0,4.0); (-3.0,2.5); (0.0,2.0)

9. Enter a triangle and calculate its the minimal altitude.
http://en.wikipedia.org/wiki/Triangle
Example: (3,1); (-1,2.5); (0,0.5)

10. Enter a triangle and its minimal median.
http://en.wikipedia.org/wiki/Triangle
Example: (31,30); (-10,1); (0,55)

11. Enter a triangle and calculate the ratio of its maximal and minimal sides.
http://en.wikipedia.org/wiki/Triangle
Example: (35,0); (-12,5); (0,0)

12. Enter four points and choose three of them which are vertexes of the triangle with the smallest area.
http://en.wikipedia.org/wiki/Area
Example: (3,1); (0,0); (2,2); (-1,0)

13. Enter a triangle and find a point placed inside it.
http://en.wikipedia.org/wiki/Triangle
Example: (3,4); (-3,2.5); (0,-4.2)

14. Enter a triangle and calculate the distance between its mass center (center of gravity) and the origin of the coordinate system.
http://en.wikipedia.org/wiki/Triangle
Example: (3,0); (-1.5,2.5); (0,0)

15. Enter four points and find two of them with the maximal distance.
http://en.wikipedia.org/wiki/Distance
Example: (30,10); (-10,0); (20,20); (-10,0)

16. Enter four points and calculate the length of the sum of segment lines, connecting these points successively.
http://en.wikipedia.org/wiki/Distance
Example: (0,0), (0.12, 0.01),  (-0.19,0); (0.10,0.15)

17. Enter four points and calculate the sum lengths of all segment lines, connecting the points.
http://en.wikipedia.org/wiki/Distance
Example: (0,0), (0.12, 0.01), (-0.19,0); (0.10,0.15)

18. Enter a segment line and check whether it intersects the coordinate axes.
http://en.wikipedia.org/wiki/Coordinate_axes
Example: (-3,4), (4,1)

19. Enter a circle and a segment line. Check whether the line lies into the circle.
http://en.wikipedia.org/wiki/Line_segment
Example: (0.022,0.023), 0.1; (-0.01,0), (0,0)

20. Enter a circle and a segment line. Check whether the circle intersects the line at only one point.
http://en.wikipedia.org/wiki/Line_segment
Example: (0.022,0.023), 0.1; (-0.01,0), (0,0)

21. Enter a circle and a point. Check whether the point lies into the circle.
http://en.wikipedia.org/wiki/Circle
Example: (0.2,0.2), 1; (-0.1,0)

22. Enter a circle and a triangle. Check whether the triangle lies into the circle.
http://en.wikipedia.org/wiki/Circle
Example: (0.2,0.2), 1; (-0.1,0); (0.01, 0.1); (0.1, -0.1)

23. Enter five points and find a circle containing all these points.
http://en.wikipedia.org/wiki/Circle
Example: (3,1); (-1,0); (-2,2); (-1,2); (1,-1)

24. Enter two circles and determine whether they intersect or not.
http://en.wikipedia.org/wiki/Circle
Example: (-2,4), 5; (-3,2), 6