Finish UE4 A1

This commit is contained in:
Ivaylo Ivanov 2021-11-08 18:28:33 +01:00
parent 30080b5480
commit 0ff4dfb0b6

View File

@ -124,7 +124,6 @@ Helper functions:
> day_to_int XXIX = 29 > day_to_int XXIX = 29
> day_to_int XXX = 30 > day_to_int XXX = 30
> day_to_int XXXI = 31 > day_to_int XXXI = 31
> day_to_int _ = 100
> month_to_int :: Monat -> Int > month_to_int :: Monat -> Int
> month_to_int Jan = 1 > month_to_int Jan = 1
@ -139,7 +138,6 @@ Helper functions:
> month_to_int Okt = 10 > month_to_int Okt = 10
> month_to_int Nov = 11 > month_to_int Nov = 11
> month_to_int Dez = 12 > month_to_int Dez = 12
> month_to_int _ = 100
> int_to_day :: Int -> Tag > int_to_day :: Int -> Tag
> int_to_day 1 = I > int_to_day 1 = I
@ -271,7 +269,6 @@ Aufgabe A.1
> else > else
> if (day_to_int t) > 29 then fm > if (day_to_int t) > 29 then fm
> else d > else d
> | monat d == Dez && (day_to_int t) > 31 = ny
> | (day_to_int t) > 30 && not(monat d `elem` full_months) = nm > | (day_to_int t) > 30 && not(monat d `elem` full_months) = nm
> | otherwise = d > | otherwise = d
> where > where
@ -279,10 +276,16 @@ Aufgabe A.1
> t = tag d > t = tag d
> fm = D (int_to_day 1) Mar y > fm = D (int_to_day 1) Mar y
> nm = D (int_to_day 1) (int_to_month ((month_to_int (monat d)) + 1)) y > nm = D (int_to_day 1) (int_to_month ((month_to_int (monat d)) + 1)) y
> ny = D (int_to_day 1) Jan (y + 1)
> correct_sum :: Geschaeftsvorfall -> AP_Geschaeftsvorfall > correct_sum :: Geschaeftsvorfall -> AP_Geschaeftsvorfall
> correct_sum g = g > correct_sum g
> | is_credit g = P_Gutschrift (gutschriftsbetrag g) (gutschrift_vom g)
> | otherwise = AP_Zahlung n (zahlung_vom g)
> where
> b = fromInteger (toInteger (cents (brutto g))) :: Float -- convert b to float
> s = skonto_to_num (skonto g)
> n = C ((round(b - (b * s))) :: Nat1)
Aufgabe A.2 Aufgabe A.2