diff --git a/code/Angabe4.lhs b/code/Angabe4.lhs index a61611b..8af8dff 100644 --- a/code/Angabe4.lhs +++ b/code/Angabe4.lhs @@ -45,53 +45,6 @@ Datenstrukturen fuer eine einfache Buchhaltung: Helper functions: -> day_to_str :: Tag -> String -> day_to_str I = "01" -> day_to_str II = "02" -> day_to_str III = "03" -> day_to_str IV = "04" -> day_to_str V = "05" -> day_to_str VI = "06" -> day_to_str VII = "07" -> day_to_str VIII = "08" -> day_to_str IX = "09" -> day_to_str X = "10" -> day_to_str XI = "11" -> day_to_str XII = "12" -> day_to_str XIII = "13" -> day_to_str XIV = "14" -> day_to_str XV = "15" -> day_to_str XVI = "16" -> day_to_str XVII = "17" -> day_to_str XVIII = "18" -> day_to_str XIX = "19" -> day_to_str XX = "20" -> day_to_str XXI = "21" -> day_to_str XXII = "22" -> day_to_str XXIII = "23" -> day_to_str XXIV = "24" -> day_to_str XXV = "25" -> day_to_str XXVI = "26" -> day_to_str XXVII = "27" -> day_to_str XXVIII = "28" -> day_to_str XXIX = "29" -> day_to_str XXX = "30" -> day_to_str XXXI = "31" - -> month_to_str :: Monat -> String -> month_to_str Jan = "01" -> month_to_str Feb = "02" -> month_to_str Mar = "03" -> month_to_str Apr = "04" -> month_to_str Mai = "05" -> month_to_str Jun = "06" -> month_to_str Jul = "07" -> month_to_str Aug = "08" -> month_to_str Sep = "09" -> month_to_str Okt = "10" -> month_to_str Nov = "11" -> month_to_str Dez = "12" - > day_to_int :: Tag -> Int > day_to_int I = 1 > day_to_int II = 2 @@ -310,6 +263,7 @@ Nur Werte zwischen 0 und 99 fuer cent! > instance Num EuroCent where > (+) s s' = (add_ec s s') > (-) s s' = (diff_ec s s') +> fromInteger i = EC (fromIntegral(i `div` 100) :: Nat1) (fromIntegral(i `mod` 100) :: Nat1) > add_ec :: EuroCent -> EuroCent -> EuroCent > add_ec s s' @@ -413,9 +367,9 @@ Aufgabe A.3 > calculate_partner_credit :: KonsolidiertesKassabuch -> EuroCent -> EuroCent > calculate_partner_credit (KKB(x:xs)) res > | length x /= 0 && null xs = -> if is_k_credit v then res + (ec_netto v) +> if is_k_credit v then res + (ec_gutschrift v) > else res -> | is_k_credit v = calculate_partner_credit (KKB(xs)) (res + (ec_netto v)) +> | is_k_credit v = calculate_partner_credit (KKB(xs)) (res + (ec_gutschrift v)) > | otherwise = calculate_partner_credit (KKB(xs)) res > where > (g,v) = x