You are on page 1of 3

- ' 11

:
: . .

.
: !

.1
{typedef struct accountType_t
;char type
;double maxWithdrawPerDay
;double minBalance
;}AccountType
{typedef struct bankAccount_t
;]char owner[50
;]char identifier[01
;double balance
;double withdrawPerDay
;AccountType* typePtr
;} BankAccount
. ,
, . 94 ,
( )0- (
).
:
( )S ( .)B 000
1000 . , 000
. 0000
9:
)int isPositiveBalance(BankAccount *bnkac

true , ( .)0
.false
int applyTransaction(BankAccount * bnkac, double
)amount

( amount , amount -).


( .
maxWithdrawPerDay- .) minBalance -
true false-.

AccountType * getAccountType(AccountType types[],


int numTypes, char type)

type - NULL- , accountType-


. accountType .

void printAccount(BankAccount *bnkac)


.) , , (

:
0 ) hard-coded(
.0 ,)(
, (
.)/
.
,


) , (:
account: 1111
account: 2222
account: 3333
account: 4444
account: 5555

owener: David
owener: Rotem
owener: Tomer
owener: Ronit
owener: Guy

balance: 0
balance: 0
balance: 0
balance: 0
balance: 0

Enter a transaction (in fmt: accountIdx amount)


0 -300
Enter a transaction (in fmt: accountIdx amount)
0 -300
The transaction is invalid!
Enter a transaction (in fmt: accountIdx amount)
1 -600
The transaction is invalid!
Enter a transaction (in fmt: accountIdx amount)
1 -200
Enter a transaction (in fmt: accountIdx amount)
1 -200
Enter a transaction (in fmt: accountIdx amount)
1 -200
The transaction is invalid!
Enter a transaction (in fmt: accountIdx amount)
3 -800
Enter a transaction (in fmt: accountIdx amount)
4 1000
Enter a transaction (in fmt: accountIdx amount)
1 2000
Enter a transaction (in fmt: accountIdx amount)
2

type: S
type: S
type: S
type: B
type: B

60
The negative balances are:
identifier: 1111
owener: David balance: -300 type: S
identifier: 4444
owener: Ronit balance: -800 type: B

You might also like