CS 119 Lab 5Data Types

Objectives

  • Define and use user defined data types
  • Perform the following tasks in the order given.

    1. Download the Lab5 project and import it into Eclipse as a Haskell project.
       
    2. Try creating a couple of shapes and computing their areas.
       
      Assignment:
      Add another case to the Shape data type which will create a Right Triangle by providing the two sides that meet at the right angle.  Modify the area function so that it computes the area of this new shape.


       


    3.  
      Assignment:
      Write a new function scale :: Float -> Shape -> Shape

      scale factor s will return a new shape object that is scaled by the given factor.


       

    4. Email your modified zipped project to me for grading.