Question: Program Description You work for an banking analytics organization have been tasked with writing a program that simulates an analysis of transactions. Code a modular
Program Description
You work for an banking analytics organization have been tasked with writing a program that simulates an analysis of transactions.
Code a modular program that uses parallel arrays to store bank transaction types deposits or withdrawals and transaction amounts in USD
The program must do the following:
The program must first ask the user for the number of bank accounts that will be in the simulation. This must be done by calling the getNumAccounts function definition below
After the input of the number of accounts, the program must use loops and random numbers to generate the account type and the transaction amount for each bank account in parallel arrays. These arrays must not be declared globally major error
The following arrays must be declared and populated:
transactionTypes an array of type string to hold the transaction type for the account. The size of the array is determined by the number of bank accounts the user entered in step The values in the array represent the type of transaction on the account deposit or "withdrawal"
transactionAmounts an array of type long to hold the amount of money from each transaction. The size of the array is determined by the number of bank accounts the user entered in step The values in the array represent the amount of money that is deposited or withdrawn during the transaction. In this bank simulation, deposits and withdrawals have a minimum amount of $ and a maximum amount of $
Populate both of these arrays by using a loop that will execute based on the number of bank accounts the user entered in step On each pass, call the generateTransactionType function definition below to generate a transaction type and store in the transactionTypes array and call the generateTransactionAmount function definition below to generate a transaction amount and store in the transactionAmounts array.
Once both of the arrays are populated, the program must display the result statistics of the simulation. This includes displaying the transaction types and the amount of money in each transaction along with counts, averages, and totals. This must be done by calling the displayStatsdefined below function that accepts both of the arrays as well as the number of bank accounts the user entered in step
In addition to the main function, declare prototypes, write function definitions and correctly call the following functions:
getNumAccounts this is an integerreturning function that must allow the user to specify the number of bank accounts that will be evaluated in the simulation. This company can simulate between and accounts in the simulation. Validate the user input so that the user must enter between and bank accounts. If the user enters an invalid number of bank accounts, they must be given an unlimited amount of chances to enter a valid number of bank accounts. The function must return the validated number of bank accounts.
generateTransactionType this is a stringreturning function that generates a random transaction type for the account. Generate a random number between the value of or first. If a is generated, the transaction is a "deposit", otherwise, the transaction is a "withdrawal". Return the string and store in the transactionTypes array in main;
generateTransactionAmount this is a longreturning function that generates a random transaction amount between $ and $ Note: use the long data type to return the transaction amount and store in the transactionAmounts array in main
displayStats Function must accept the parallel arrays that contain the transaction types, transaction amounts, as well as the number of accounts in the simulation and display the transaction number along with the transaction type and the transaction amount formatted with proper spacing on separate lines to match the sample output. Then calculate and display the following:
The total number of transactions count
The total number of deposits count
The total number of withdrawals count
The average amount per deposit
The average amount per withdrawal
The average amount per transaction
The total amount deposited
The total amount withdrawn
The total amount transacted
Other Notes:
Program Output and Prompts MUST MATCH the formatting of the sample runs EXACTLY.
No Global data can be used in the program
Functions MUST be written and called as instructed above. Only the functions that are instructed are permitted.
Ensure that the random generated data is different every time the program is executed.
CODE MUST BE ADEQUATELY COMMENTED
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
