2CS21 PRACTICAL EXERCISE 4 - TRIANGLE RECOGNITION

(Week 7 Starting November 9th)

Hand in date - one week after your scheduled tutorial session in week 7.


1. REQUIREMENTS

Produce an Ada program which, given three sides of a triangle, determines whether the triangle is:

  1. Equilateral - all sides the same length,
  2. Isosceles - two sides the same length or
  3. Scalene - no sides the same length

Further, where a Scalene triangle is identified, determine whether it is:

  1. Right angled,
  2. Acute (all angles less than 90 degrees), or
  3. Obtuse (one angle greater than 90 degrees).

Note that a right angled triangle is one where:

b^2 + c^2 = a^2 (Pythagoras)

where a is the longest side. Where a triangle is not an equilateral, isosceles or right angled, it is either an acute or obtuse Scalene triangle. This can be determined as follows:

b^2 + c^2 > a^2 (Acute)
b^2 + c^2 < a^2 (Obtuse)
TRIANGLES

Assume that any individual side must be a positive number not greater than 100.0.


2. REPORT

You should hand in a report comprising the following sections:

  1. Requirements
  2. Design - including top down analysis, N-S charts and flow chart
  3. Implementation
  4. Black box, white box and data validation test cases and results

Marks will be distributed evenly over design, implementation and testing. Refer to guidance notes on the presentation of work if necessary.




Created and maintained by Frans Coenen. Last updated 11 October 1999