module RestRate2 where

-- Modify RestRate1 to have a single function, with a non-numeric
-- argument to indicate the sex of the subject.  Our first
-- user-defined type! 
-- Source: CSIRO Wellbeing Diet Book

-- Clem Baker-Finch
-- COMP1100 semester 1 2006

-- A new data type

data Sex = Male | Female

-- We can have two clauses in the definition, using constant patterns
-- to distinguish:

restRate :: Sex -> Float -> Float -> Float -> Float
restRate Male   weight height age =
    (66.47 + 13.75 * weight + 5 * height - 6.76 * age) * 4.2
restRate Female weight height age = 
    (655.1 + 9.56 * weight + 1.85 * height - 4.68 * age) * 4.2


