Fix some bugs in UE4 A.3

This commit is contained in:
Ivaylo Ivanov 2021-11-10 18:51:10 +01:00
parent cce90430ad
commit 79815796af

View File

@ -45,53 +45,6 @@ Datenstrukturen fuer eine einfache Buchhaltung:
Helper functions: 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 :: Tag -> Int
> day_to_int I = 1 > day_to_int I = 1
> day_to_int II = 2 > day_to_int II = 2
@ -310,6 +263,7 @@ Nur Werte zwischen 0 und 99 fuer cent!
> instance Num EuroCent where > instance Num EuroCent where
> (+) s s' = (add_ec s s') > (+) s s' = (add_ec s s')
> (-) s s' = (diff_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 :: EuroCent -> EuroCent -> EuroCent
> add_ec s s' > add_ec s s'
@ -413,9 +367,9 @@ Aufgabe A.3
> calculate_partner_credit :: KonsolidiertesKassabuch -> EuroCent -> EuroCent > calculate_partner_credit :: KonsolidiertesKassabuch -> EuroCent -> EuroCent
> calculate_partner_credit (KKB(x:xs)) res > calculate_partner_credit (KKB(x:xs)) res
> | length x /= 0 && null xs = > | 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 > 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 > | otherwise = calculate_partner_credit (KKB(xs)) res
> where > where
> (g,v) = x > (g,v) = x