This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.c
46 lines (39 loc) · 1.51 KB
/
functions.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
float net_balance(float account_balance, float minimum_balance_fee) {
return(account_balance - minimum_balance_fee);
}
float get_account_balance() {
float account_balance;
printf ("Please enter the account balance:\n");
scanf ("%f", &account_balance);
return(account_balance);
}
char get_account_type() {
char account_type;
printf ("c = checking, s = saving\n");
printf ("Please enter the account type:\n");
scanf (" %c", &account_type);
return(account_type);
}
int is_account_below_minimum_balance(float account_balance, float minimum_balance) {
int minimum_balance_fee_charged_flag = MINIMUM_BALANCE_FEE_NOT_CHARGED;
if (account_balance < minimum_balance) {
minimum_balance_fee_charged_flag = MINIMUM_BALANCE_FEE_CHARGED;
printf ("A minimum balance fee needs to be charged to this account.\n");
} else {
minimum_balance_fee_charged_flag = MINIMUM_BALANCE_FEE_NOT_CHARGED;
printf ("A minimum balance fee does not need to be charged to this account.\n");
}
return(minimum_balance_fee_charged_flag);
}
char ask_to_exit() {
char exit_program_flag;
printf ("\n");
printf ("Are you finished checking all your accounts?:\n");
printf ("Enter 'n' to check more accounts; Enter any other character to exit\n");
scanf (" %c", &exit_program_flag);
return(exit_program_flag);
}
void update_account_summary_information(int *total_number_of_accounts, float *total_amount_in_accounts, float account_balance) {
(*total_number_of_accounts)++;
*total_amount_in_accounts += account_balance;
}