Answer:
See Explaination
Explanation:
The Problem information is as follows:
The input: A data file containing the bank account information.Accounts are of different
types (like Savings Account, Checking Accounts).
The Output: Report on Number of Savings Account, Number of Checking accounts and their
total balances, avregae balance, maximum and minimum balance etc
Processing:
Read the file data
Consider valid account data
Separate different accounts
Calculate the sum of their balances
Calculate the average balnace for each type of account
Display the information
Solution:
1.The application should be able to read the csv file.
2.All the error checking should be done as per defined rules
3.The report should be generated in the defined format
4.Data display precisions need to be followed.
5.Interactive errors should be reported with proper messages
6.Integrity of the data should be maintaied while saving the data.
7. Calculation of the averageAccountBalance = (Sum of all the balances of a particular type of account)/(number of that type of account)
8. TotalAccountBalance = Sum of all the balances of each type of account.
9. To find maximum start with a default value and then traverse all the accounts and update the maximum value as per the comparison results
and same for minimum.
Input Validation:
1.Check for the filename (maximum length is 10 chars besides the csv extension)
2.account number (12 digits, first three entries are alphabets)
3.Name (Only alphabets are allowed)
4.Phone Number (7 digits must follow the format xxx-xxx-x)
pesudoCode:
Input filename
open the file
declare accounts[] array
Read the data in accounts and update numOfAccounts
declare numOfAccounts, numOfSavingActs, numOfCheckingActs, totalBalanceSavings, totalBalanceChecking, averageBalanceChecking
averageBalanceSavings, maximumSaavings, minimumSavings, maximumChecking, minimumChecking
for i = 1 to n:
if (Validate(account[i])):
if account[i].type == "Savings":
numOfSavingActs++
totalBalanceSavings = totalBalanceSavings + account[i].balance
if account[i].balance > maximumSavings:
maximumSavings = account[i].balance
if account[i].balance < minimumSavings:
minimumSavings = account[i].balance
if account[i].type == "Checkings":
numOfSavingActs++
totalBalanceSavings = totalBalanceSavings + account[i].balance
if account[i].balance > maximumSavings:
maximumSavings = account[i].balance
if account[i].balance < minimumSavings:
minimumSavings = account[i].balance
Display(Data)