Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Banking System Program Write a program that reads (each time the program is executed) from the secondary storage from a file named accounts.txt the

C++ Banking System Program

Write a program that reads (each time the program is executed) from the secondary storage from a file named accounts.txt the account numbers and balances into a multi-dimensional array

Your program will ask the user to choose one of the following options:

1. Deposit Money

2. Withdraw Money

3. Transfer Money

4. Show Transactions

5. Open an Account

6. Close an Account

7. Sort Accounts from largest balance to smallest

8. Sort Accounts in alphabetical order using the account owners name

9. Quit Program

-The program will have at least ten user-defined functions (one function for each of the eight

options 1-8, one to print the options menu, and one to find the index of the account in the array).

-The program will save the transactions information in a separate file that has the same name as

the account number (e.g. for account number: 15689 the file name will be 15689.txt)

- If the user tries to withdraw more than the available balance an error message will be displayed

and the transaction will not be processed.

-Closing an account will only flag the account rather than permanently delete the account.

-If the user tries to close a non-zero balance account an error message will be displayed and the

transaction will not be processed.

- When the user decides to quit the new balances are saved back to the secondary storage to the

same file (i.e. accounts.txt)

Option Fuctions:

- The first functions name is printOptionsMenu, which will print (show on the screen)

-----------------------------------------------------------------------------------------------------

Please choose one of the following options:

1. Deposit Money

2. Withdraw Money

3. Transfer Money

4. Show Transactions

5. Open an Account

6. Close an Account

7. Sort Accounts from largest balance to smallest

8. Sort Accounts in alphabetical order using the account owners name

9. Quit Program

-----------------------------------------------------------------------------------------------------

- The second functions name is getArrayIndexOfAccount, which receives two parameters (the

account number and the array of accounts) and returns the index of the account in the array if

found; otherwise; the function returns -1.

- The third functions name is depositMoney, which receives three parameters (the index of the

account in the array, the amount to be deposited, and the array of accounts). The function will

update the balance and will save the transactions information (including the date and time) in the

file that has the same name as the account number.

- The fourth functions name is withdrawMoney, which receives three parameters (the index of the

account in the array, the amount to be withdrawn, and the array of accounts). The function will

update the balance and will save the transactions information (including the date and time) in the

file that has the same name as the account number.

-The fifth functions name is openAccount, which asks for the account owners information (e.g.

name and opening balance). The function will add a new record to the array of accounts and

accounts.txt as well as create a new file (with the same name as the account number) and update

the transactions information (including the date and time) with the opening balance.

- The sixth functions name is closeAccount, which checks the balance before flagging the account

as deleted. If the balance is not zero, an error message will be displayed and the transaction will

not be processed.

- The seventh functions name is sortBalances, which receives one parameter (the array of

accounts). The function will sort and display the accounts (without changing the original array)

from largest balance to smallest.

- The eight functions name is sortNames, which receives one parameter (the array of accounts).

The function will sort and display the accounts (without changing the original array) in

alphabetical order using the account owners name.

Additional requirements:

-Must use exact function names with the exact letter cases (upper and lower case letters)

-All functions (except the main function) will be defined as follows:

1. The function prototype appears before the main

2. Comment describing what the function does appears directly under function prototype

3. Formal variable names are not used in any prototype

4. The functions definition appears after the main

-Use self-documenting variable names

Sample contents of the accounts.txt file:

Serial Account FirstName LastName Balance Flag

1 56897 Richard Dustin 1001.59 0

2 43534 Michael Smith 123.55 0

3 65743 George Gonzales 10.66 0

4 43346 Donald Malik 0 1

5 97867 Owen Evelyn 5527.10 0

6 38531 Lucas Wyatt 7891.22 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions