Dr. Norman needs your help once again, last time, you helped him in classifying various drawings(3 sided enclosed figures) that were found near the archeology site. This time, a new discovery has been made. The drawings are 4 sides shapes (quadrilaterals). The length of the sides and angles of each corner was recorded. The analysis of these shapes could help shed some light on the level of knowledge of geometry that was prevalent among the civilization at that time.
Program
Write a program to determine what kind of quadrilateral the drawing is it?
Input
- The length of four sides of the shape.
- The angles of the fours corners in degrees.
Output
- The drawing is a square, rhombus, rectangle, parallelogram, kite, trapezoid or a general quadrilateral.
Facts
- The sum of any three sides in a quadrilateral is greater than the fourth side.
- The sum of all the angles of a quadrilateral is 360.
Shape | Sides | Angles |
---|---|---|
Square | All sides are equal and parallel | Each angle is 90 (A=B=C=D=90). |
Rhombus | All sides are equal and parallel | Opposite angles are equal but not 90 (A=C and B=D). |
Rectangle | Opposites sides are equal and parallel | Each angle is 90 (A=B=C=D=90). |
Parallelogram | Opposites sides are equal and parallel | All the pairs of consecutive angles are supplementary e.g.(A+B=180 and C+D=180) OR (A+D=180 and B+C=180). |
Kite | Adjacent sides are equal | The opposite angles are equal where the two side pairs meet (A=C). |
Trapezoid | One pair of parallel sides | Only one pair of consecutive angles are supplementary and others are, not e.g. (A+D=180 but B+C <> 180) OR (A+D<>180 but B+C = 180). |
Quadrilateral | None of the sides are equal or parallel | None of the consecutive angles are supplementary. |
Assumptions.
- Each side is > 0 and a whole number.
- The 4 sides provided as input are not sorted by length of sides.
Test cases
No | Input (Sides and their vertices angles) | Output (Result) |
---|---|---|
1 | 10 10 10 10 90 90 90 90 | square |
2 | 10 10 10 10 65 115 65 115 | rhombus |
3 | 20 10 20 10 90 90 90 90 | rectangle |
4 | 10 20 10 20 120 60 120 60 | parallelogram |
5 | 10 10 5 5 110 80 110 60 | kite |
6 | 10 12 6 11 106 130 50 74 | trapezoid |
7 | 10 12 6 11 100 95 60 105 | quadrilateral |
Logic
Instructions
- Accept the 8 whole numbers as input via the command line arguments. The first four numbers are the length of the sides A, B, C, D, and the next four numbers are the angles between the sides A, B, C, D respectively.
- Write the logic to compute what kind of quadrilateral it is.
- Display your analysis result. While printing please make sure it prints the type of quadrilateral without a new line.
By the way, Dr. Norman appreciates your help and send has his thanks in advance to help him solve the mystery of ancient civilization.