Assignment #5 - 90A

Assignment #5 - 90A


ASSIGNMENT 5                                              Weight 20
------------                                              Due  7 March 90

   You are given eight sets of three values each:

       23.37   19.51    8.37
       57.46   40.06   27.57
       42.09   35.78   61.65
        8.63   15.74   12.38
        61.94  78.07   10.87
        19.56  23.54   33.28
        84.37  61.98   15.93
        37.80  49.24   23.51

   Write a Pascal program to determine if the three values of a
   set could represent the lengths of the sides of a triangle.  If the
   three sides could make a triangle, calculate its area and print a
   message like:
              When AB=3.00 and BC=4.00 and CA=5.00,
                  the area of triangle ABC is 6.00


   If a, b, c are three side lengths, then the area is

     SQRT(  (s(s-a)(s-b)(s-c)) )

   where s is the half perimeter (a+b+c)/2
   (the formula is due to Hero, a mathematician of ancient times.)


   If the three values in a set could not represent the sides of a
   triangle, print a message like
        23.37, 19.51, and 9.37 could not possibly be the sides of a
                                                    triangle

   A property of Hero's formula:  if  s(s-a)(s-b)(s-c)  is negative,
                                  then a, b, c can't make a triangle.


   Please MAKE SURE YOU PUT your name, student #, and assignment #.
   Also, put some comments on your code so that the grader can
   figure out what you are doing.  It helps to have meaningful
   variable name, like AREA instead of X for a variable containing an
   area value.