summaryrefslogtreecommitdiffstats
path: root/bank-eiffel/account.e
diff options
context:
space:
mode:
Diffstat (limited to 'bank-eiffel/account.e')
-rw-r--r--bank-eiffel/account.e34
1 files changed, 23 insertions, 11 deletions
diff --git a/bank-eiffel/account.e b/bank-eiffel/account.e
index 6c81313..154a1fa 100644
--- a/bank-eiffel/account.e
+++ b/bank-eiffel/account.e
@@ -23,7 +23,7 @@ feature -- Access
23 transfer_minamount: REAL_64 assign set_transfer_minamount 23 transfer_minamount: REAL_64 assign set_transfer_minamount
24 -- Mindestbetrag für jede Einzahlung, Auszahlung und Überweisung 24 -- Mindestbetrag für jede Einzahlung, Auszahlung und Überweisung
25 25
26 authorized_signers: SET [PERSON] 26 authorized_signers: ARRAYED_SET [PERSON]
27 -- Zeichnungsberechtigte 27 -- Zeichnungsberechtigte
28 attribute Result := ({like authorized_signers}).default end --| Remove line when Void Safety is properly set 28 attribute Result := ({like authorized_signers}).default end --| Remove line when Void Safety is properly set
29 29
@@ -39,11 +39,13 @@ feature -- Access
39 balance: REAL_64 39 balance: REAL_64
40 -- Kontostand 40 -- Kontostand
41 41
42feature -- Initialization 42feature {NONE} -- Initialization
43 43
44 make (an_authorized_signer: PERSON) 44 make (an_authorized_signer: PERSON)
45 do 45 do
46 create authorized_signers.make(1)
46 add_authorized_signer (an_authorized_signer) 47 add_authorized_signer (an_authorized_signer)
48 transfer_minamount := 2
47 balance := 0 49 balance := 0
48 end 50 end
49 51
@@ -67,21 +69,19 @@ feature -- Basic operations
67 do 69 do
68 balance := balance - an_amount 70 balance := balance - an_amount
69 ensure 71 ensure
70 balance_increased: balance < old balance 72 balance_decreased: balance < old balance
71 withdrawed: balance = old balance - an_amount 73 withdrawed: balance = old balance - an_amount
72 creditline_ok: balance >= creditline 74 creditline_ok: balance >= creditline
73 end 75 end
74 76
75feature -- Element change 77 transfer(an_amount: like transfer_minamount; an_account: like Current)
76
77 set_transfer_minamount (a_transfer_minamount: like transfer_minamount)
78 -- Assign `transfer_minamount' with `a_transfer_minamount'.
79 require 78 require
80 a_transfer_minamount_positive: a_transfer_minamount > 0.0 79 an_amount_positive: an_amount > 0.0
80 transfer_minamount_ok: an_amount >= transfer_minamount
81 an_account_attached: an_account /= Void
81 do 82 do
82 transfer_minamount := a_transfer_minamount 83 withdraw (an_amount)
83 ensure 84 an_account.deposit (an_amount)
84 transfer_minamount_assigned: transfer_minamount = a_transfer_minamount
85 end 85 end
86 86
87 add_authorized_signer (an_authorized_signer: PERSON) 87 add_authorized_signer (an_authorized_signer: PERSON)
@@ -105,6 +105,18 @@ feature -- Element change
105 authorized_signers_assigned: not authorized_signers.has (an_authorized_signer) 105 authorized_signers_assigned: not authorized_signers.has (an_authorized_signer)
106 end 106 end
107 107
108feature {NONE} -- Implementation
109
110 set_transfer_minamount (a_transfer_minamount: like transfer_minamount)
111 -- Assign `transfer_minamount' with `a_transfer_minamount'.
112 require
113 a_transfer_minamount_positive: a_transfer_minamount > 0.0
114 do
115 transfer_minamount := a_transfer_minamount
116 ensure
117 transfer_minamount_assigned: transfer_minamount = a_transfer_minamount
118 end
119
108 set_creditline (a_creditline: like creditline) 120 set_creditline (a_creditline: like creditline)
109 -- Assign `creditline' with `a_creditline'. 121 -- Assign `creditline' with `a_creditline'.
110 do 122 do