The Bank of West provides a customer with a checking and savings account. For both checking and saving accounts each, a free checkbook is issued to the customer.
Program
Write a program to calculate the monthly fees a customer should be charged for maintenance and using services of both the checkings and the savings account.
Input
- The number of checks written against the Checking Account.
- The checkings account balance at the end of the month.
- The savings account balance at the end of the month.
- The number of checks written against the Savings Account.
Output
- The monthly fee to charge for account maintenance and services used.
Assumptions
- The account balances used provided as input is rounded off nearest whole number.
Requirement
A customer is charged a flat monthly fee of $10 for maintenance of the checking account irrespective of the balance of the checking account. Whereas no fees are charged for maintenance of savings account as long as a minimum balance (>= $5,000) is maintained in both the accounts combined else is charged $10 monthly fee for saving accounts.
Depending on the number of checks written against the checking account a certain fee is calculated. Whereas in case of savings account, the first N (N=5) checks in the month incur no fee but afterward for each check issued, a $0.25 per check fee is accessed.
The fees for checking the account for the number of the checks issued in the month is calculated as follows:
No of checks | Fees in cents |
---|---|
less than equal to 20 checks | 20¢ per check |
less than equal to 30 checks | 15¢ per check |
less than equal to 50 checks | 10¢ per check |
more than 50 checks | 5¢ per check |
Test cases
No | Input (Checking Balance) | Input (Checking Checks Issued) | Input (Savings Balance) | Input (Savings Checks Issued) | Command-Line Input | Output (Fees) |
---|---|---|---|---|---|---|
1 | 2000 | 0 | 5000 | 3 | 2000 0 5000 3 | 10.00 |
2 | 2000 | 15 | 2000 | 0 | 2000 15 4000 0 | 23.00 |
3 | 2000 | 40 | 3500 | 5 | 2000 40 3500 5 | 14.00 |
4 | 3000 | 10 | 1000 | 10 | 3000 10 1000 10 | 33.25 |
5 | 5000 | 60 | 6000 | 5 | 5000 60 6000 5 | 13.00 |
Instructions
- Accept the four whole numbers as input via the command line arguments.
- The inputs are in the following order: Checking Balance, Checking Checks Issued, Savings Balance, Savings Checks Issued.
- Write the logic to compute the monthly fees.
- Display the monthly fees formatted and rounded to two decimal places.