Homework_1

[Arithmetics, Graphics Objects, The if Statement]

Write a graphics program that prompts the user to enter graphics objects using the mouse or/and the keyboard. Draw these graphics objects, make the calculations and print out the results. For some tasks you need to read "The if Statement" section in Chapter 4.
Your program must be tested with an example given after every task.
The number of your particular task is the value of the expression faculty_number%25 (remainder of integer division).


0. Enter a triangle and calculate its area.
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.
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.
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.
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.
http://en.wikipedia.org/wiki/Inscribed
Example: (2,2.1); (-3,2.5); (0,0)

5. Enter a triangle and determine the type of the triangle - 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 of the bisector length of its maximal angle.
http://en.wikipedia.org/wiki/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 perimeter 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 calculate its perimeter 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 of the lines length, connecting each two 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