Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Write C Write Program Manages Bank Accounts Specifically Program Allows User Enter Data Re Q35542956

Write in C++

Write a program that manages bank accounts. Specifically, theprogram allows the user to enter the data related to an account,and list the data related to accounts. The data related to anaccount is maintained in the following structures:struct Person string namei string addressi struct Account int accountNumber Person ownerInfoi double balance

1. Additional Requirements – Make sure you meet all therequirements to avoid losing points

a) Outline of main:

Prompt the user to enter the maximum number of Accounts. Perform input validation. A valid value is an integer > 0 Dynamicall

For all the above input validations, the program should ask theuser to reenter as long as the input is invalid, up to 5 attempts(the initial input counts as one attempt). If the maximum number ofattempts is reached, the program prints an error message andterminates.
An account number is valid if it is an integer > 0
A balance is valid is it consists only of digits and at most onedot. If there is a dot, there are at most two digits after thedot.

b) Functions:

You are required to implement your program with these functions.You may implement more functions to make your program more modularif you wish.
• populateAccount: This function takes as arguments the array ofAccounts, the number of Accounts populated so far passed byreference, and the size of the array passed by value. It promptsthe user for the data and populates the next available element ofthe Account array. It performs all the necessary input validations.It prints an error message if there is no available element. Thefunction returns void.
• printAccount: This function takes as argument an Accountstructure variable passed by reference. It prints the content ofthe structure variable. The function returns void.
For the two above functions, you must use the proper qualifier(s)to comply with the principle of least privilege. You will fail theunit test if you don’t comply with the principle of leastprivilege.

c) Style:

Make sure you follow the style requirements, especiallyregarding the comment header for functions, to avoid losingpoints.

2. Implementation Suggestions – You are not required toimplement the suggestions

For the input validation, you can use getline to read the user’sinput.
You are allowed to use any of the existing library functions inchapter 10 of the Gaddis textbook to check input validity. You arealso allowed to reuse code that you wrote for the previoushomeworks.

3. Extra credit

You can earn 5 points extra credit if your program checks theaccount number entered at choice 1 is not a duplicate of anexisting account. If it is a duplicate account number, the programasks the user to reenter, up to 5 attempts (the initial inputcounts as one attempt). After 5 unsuccessful attempts, the programprints an error message and terminates.

4. Grading Criteria

a) Source code inspection (grader):

Style: 5 points (refer to the “Homework Notes” for the stylerequirements)

b) Program compilation and execution (zylabs):

Output test-1 – Array creation with input validation and menudisplay – Output starts like output-1: 3 points.
Output test-2 – Array creation with input validation, max number ofattempts reached – Output matches output-2: 3 points.
Output test-3 – Display menu with input validation, max number ofattempts reached – Output matches output-3: 3 points.
Output test-4 – Enter data for an account with input validation onthe data – Output matches output-4: 10 points
Output test-5 – Enter data for an account with input validation onthe data, max number of attempts reached – Output matches output-5:3 points
Output test-6 – Enter data for an account, array full – Outputmatches output-6: 9 points
Output test-7 – Enter data for an account, array full – Outputmatches output-7: 9 points
Output test-8 – Display data for an account with input validationon the account number– Output matches output-8: 8 points
Output test-9– Display data for an account, no account found –Output matches output-9: 7 points
Output test-10 – Display data for all accounts – Output matchesoutput-10: 20 points
Output test-11 (Extra credit) – Enter data for an account withinput validation, extra credit – Output matches output-11: 5points
Unit test-1 – populateAccount: 10 points
Unit test-2 – populateAccount-full: 5 points
Unit test-3 – printAccount: 5 points

5. Screen Outputs

Enter max number of accounts: -1 Invalid value, please reenter: -2 Invalid value, please reenter 2 Menu: 1->Enter data for sp

Enter max number of accounts: 3 Menu: 1-Enter data for specific account, 2-Display data for specific account 3-Display data f

Enter max number of accounts: 5 Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display dat

Enter max number of accounts 4 Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display data

Enter max number of accounts: 2 Menu: 3-Display data for 4->Quit : accounts , Enter account number: 100 Enter balance: 1000.8

Enter max number of accounts 1 Menu 1->Enter data for specific account, 2->Display data for specific account 3->Display data

Enter max number of accounts: 3 Menu 1->Enter data Eor specific account, 2-Display data for specific account 3- Display data

Enter max number of accounts: 3 Menu: 1-Enter data for specific account, 2->Display data for specific account 3->Display data

Enter max umber of accounts: 5 Henu 1-Enter data Eor specific account, 2->Display data for specific account 3-Display data fo

Enter max number of accounts: 3 Menu: 1- Enter data for specific account, 2-Display data for specific account 3->Display data

struct Person string namei string addressi struct Account int accountNumber Person ownerInfoi double balance Prompt the user to enter the maximum number of Accounts. Perform input validation. A valid value is an integer > 0 Dynamically allocate an array of Accounts of the size entered by the user Display the menu of choices: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts, 4->Quit Perform input validation on the user’s choice. A user’s choice is valid if it is a choice on the menu. If the user chooses 1, prompt the user for the account data, a。input validation on the account number and balance, and populate the next available element of the Account array. The next available element is the lowest index element that is not populated. If there is no available element (array is full), print an error message. Then display the menu again If the user chooses 2, prompt the user for the account number. Perform input validation. If there is no account with that number, print an error message. Else, display the data related to the account. Then display the menu again If the user chooses 3, print the data of all the accounts that have been populated. Then display the menu again. If the user chooses 4, terminate the program. Enter max number of accounts: -1 Invalid value, please reenter: -2 Invalid value, please reenter 2 Menu: 1->Enter data for specific account, 2->Diplay data for specific account 3->Display data for all accounts ,4->Quit: Output-1 Enter max number。f accounts: &% ^ Invalid value, please reenter 9IO Invalid value, please reenter: -1 Invalid value, please reenter 200 Invalid value, please reenter+ Too many unsuccessful attempts, exiting Output-2 Enter max number of accounts: 3 Menu: 1-Enter data for specific account, 2-Display data for specific account 3-Display data for all accounts , 4-Quit: $4 Invalid choice, please reenter: a kb Invalid choice, please reenter 5 Invalid choice, please reenter: 0 Invalid choice, please reenter: 1. Too many unsuccessful attempts, exiting Output-3 Enter max number of accounts: 5 Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: 1 Enter account number: 100a invalid value, please reenter: #200 Invalid value, please reenter 1 100 Invalid value, please reenter: 100 Enter balance: $4000 Invalid value, please reenter: %500 Invalid value, please reenter: 60 7 Invalid value, please reenter: 1000 Enter owner’s name: Han Solo Enter owner’s address: 5 Galaxy Way Menu 1-»Enter data for specific account, 2->Display data for specific account 3-Display data for all accounts 4-Quit: Output-4 Enter max number of accounts 4 Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: Enter account number: 200 Invalid value, please reenter: #$ cb Invalid value, please reenter (90) Invalid value, please reenter: 100.005 Invalid value, please reenter: qwer Too many unsuccessful attempts, exiting Output-5 Enter max number of accounts: 2 Menu: 3-Display data for 4->Quit : accounts , Enter account number: 100 Enter balance: 1000.8 Enter owner’ s name: Chewie Enter owner’s address: 800 N Comet Way Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: Enter account number 200 Enter balance: 2000.11 Enter owner s name R2 D2 Enter owner ‘3 address: 800 Galaxy Way Menu: 1->Enter data for specific account, 2->Display data for specific account 3-Display data for all accounts 4-uit: Cannot execute, array is full Menu: 3-Display data for all accounts 4-Quit: Output-6 Enter max number of accounts 1 Menu 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: 1 Enter account number 300 Enter balance: 3000 Enter owner’s name: Mr. Spock Enter owner’s address: 5 Enterprise Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: 1 Cannot execute, array is full Menu: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: Output-7 Enter max number of accounts: 3 Menu 1->Enter data Eor specific account, 2-Display data for specific account 3- Display data for all accounts 4-uit: Enter account number: 100 Enter balance 100.99 Enter owner s name: Uhura Enter owner’s address: 5 Enterprise Menu 1->Enter data Eor specific account, 2->Display data Eor specific account 3-Display data for all accounts 4-Quit Enter account number: 200 Enter balance: 50.1 Enter owner’s name: Mc Coy Enter owner’s address: Enterprise Menu 1-Enter data Eor specific account, 2-Display data for specific account 3-Display data for all accounts 4-0uit Enter account number: 100 Invalid value, please reenter: 100# Invalid value, please reenter: 100 Account #: 100 Owner’ s name: Uhura Oner’s address 5 Enterprise Balance: 100.99 Menu 1-Enter data Eor specific account, 2-Display data for specific account 3->Display data for all accounts 4-0uit Output-8 Enter max number of accounts: 3 Menu: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4->Quit: Enter account number 100 Enter balance: 100.99 Enter owner’s name: Uhura Enter owner’s address 5 Enterprise Menu: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4->Quit: Enter account number 200 Enter balance: 50.1 Enter owner’s name: Mc Coy Enter owner’s address 6 Enterprise Menu: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4->Quit: Enter account number: *100 Invalid value, please reenter: 300 Account not found Menu: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4->Quit: Output-9 Enter max umber of accounts: 5 Henu 1-Enter data Eor specific account, 2->Display data for specific account 3-Display data for all accounts 4-uit: Enter account number: 100 Enter balance: 1000.11 Enter owner’ s name: Chewbacca Enter owner’s address: Starfleet 1 Menu 1- Enter data Eor specific account, 2-Display data or specific account 3-Display data for all accounts 4-Quit Enter account number: 500 Enter balance: 5000.5 Enter owner’s name: L Skywalker Enter owner’s address: Starfleet 2 Menu 1-Enter data Eor specific account, 2-Display data for specific account 3-Display data for all accounts , 4-Quit Account #: 100 Owner s name: Chewbacca Owner s address:Starfleet i Balance: 1000.11 Account #: 500 Owner’s name: L Skywalker Owner s address: Starfleet 2 Balance: 5000.5 Menu 1-Enter data Eor specific account, 2-Display data Eor specific account 3-Display data for all accounts ,4-Quit Output-10 Enter max number of accounts: 3 Menu: 1- Enter data for specific account, 2-Display data for specific account 3->Display data for all account 3 , 4->Quit: Enter account number 20 Enter balance: 201.25 Enter owner’s name: Mr. Chekov Enter owner’s address 3 Enterprise Menu: r data for specific account, 2-5Display data for specific account 3->Display data for all accounts 4-Quit: Enter account number 10 Enter balance: 123.45 Enter owner ‘s name Obi-Wan Enter owner ‘s address: 4 Enterprise Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all account 3 , 4->Quit: 1 Enter account number 10 Duplicate account number Output-11 Show transcribed image text struct Person string namei string addressi struct Account int accountNumber Person ownerInfoi double balance
Prompt the user to enter the maximum number of Accounts. Perform input validation. A valid value is an integer > 0 Dynamically allocate an array of Accounts of the size entered by the user Display the menu of choices: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts, 4->Quit Perform input validation on the user’s choice. A user’s choice is valid if it is a choice on the menu. If the user chooses 1, prompt the user for the account data, a。input validation on the account number and balance, and populate the next available element of the Account array. The next available element is the lowest index element that is not populated. If there is no available element (array is full), print an error message. Then display the menu again If the user chooses 2, prompt the user for the account number. Perform input validation. If there is no account with that number, print an error message. Else, display the data related to the account. Then display the menu again If the user chooses 3, print the data of all the accounts that have been populated. Then display the menu again. If the user chooses 4, terminate the program.
Enter max number of accounts: -1 Invalid value, please reenter: -2 Invalid value, please reenter 2 Menu: 1->Enter data for specific account, 2->Diplay data for specific account 3->Display data for all accounts ,4->Quit: Output-1 Enter max number。f accounts: &% ^ Invalid value, please reenter 9IO Invalid value, please reenter: -1 Invalid value, please reenter 200 Invalid value, please reenter+ Too many unsuccessful attempts, exiting Output-2
Enter max number of accounts: 3 Menu: 1-Enter data for specific account, 2-Display data for specific account 3-Display data for all accounts , 4-Quit: $4 Invalid choice, please reenter: a kb Invalid choice, please reenter 5 Invalid choice, please reenter: 0 Invalid choice, please reenter: 1. Too many unsuccessful attempts, exiting Output-3
Enter max number of accounts: 5 Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: 1 Enter account number: 100a invalid value, please reenter: #200 Invalid value, please reenter 1 100 Invalid value, please reenter: 100 Enter balance: $4000 Invalid value, please reenter: %500 Invalid value, please reenter: 60 7 Invalid value, please reenter: 1000 Enter owner’s name: Han Solo Enter owner’s address: 5 Galaxy Way Menu 1-»Enter data for specific account, 2->Display data for specific account 3-Display data for all accounts 4-Quit: Output-4
Enter max number of accounts 4 Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: Enter account number: 200 Invalid value, please reenter: #$ cb Invalid value, please reenter (90) Invalid value, please reenter: 100.005 Invalid value, please reenter: qwer Too many unsuccessful attempts, exiting Output-5
Enter max number of accounts: 2 Menu: 3-Display data for 4->Quit : accounts , Enter account number: 100 Enter balance: 1000.8 Enter owner’ s name: Chewie Enter owner’s address: 800 N Comet Way Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: Enter account number 200 Enter balance: 2000.11 Enter owner s name R2 D2 Enter owner ‘3 address: 800 Galaxy Way Menu: 1->Enter data for specific account, 2->Display data for specific account 3-Display data for all accounts 4-uit: Cannot execute, array is full Menu: 3-Display data for all accounts 4-Quit: Output-6
Enter max number of accounts 1 Menu 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: 1 Enter account number 300 Enter balance: 3000 Enter owner’s name: Mr. Spock Enter owner’s address: 5 Enterprise Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: 1 Cannot execute, array is full Menu: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4-Quit: Output-7
Enter max number of accounts: 3 Menu 1->Enter data Eor specific account, 2-Display data for specific account 3- Display data for all accounts 4-uit: Enter account number: 100 Enter balance 100.99 Enter owner s name: Uhura Enter owner’s address: 5 Enterprise Menu 1->Enter data Eor specific account, 2->Display data Eor specific account 3-Display data for all accounts 4-Quit Enter account number: 200 Enter balance: 50.1 Enter owner’s name: Mc Coy Enter owner’s address: Enterprise Menu 1-Enter data Eor specific account, 2-Display data for specific account 3-Display data for all accounts 4-0uit Enter account number: 100 Invalid value, please reenter: 100# Invalid value, please reenter: 100 Account #: 100 Owner’ s name: Uhura Oner’s address 5 Enterprise Balance: 100.99 Menu 1-Enter data Eor specific account, 2-Display data for specific account 3->Display data for all accounts 4-0uit Output-8
Enter max number of accounts: 3 Menu: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4->Quit: Enter account number 100 Enter balance: 100.99 Enter owner’s name: Uhura Enter owner’s address 5 Enterprise Menu: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4->Quit: Enter account number 200 Enter balance: 50.1 Enter owner’s name: Mc Coy Enter owner’s address 6 Enterprise Menu: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4->Quit: Enter account number: *100 Invalid value, please reenter: 300 Account not found Menu: 1-Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts 4->Quit: Output-9
Enter max umber of accounts: 5 Henu 1-Enter data Eor specific account, 2->Display data for specific account 3-Display data for all accounts 4-uit: Enter account number: 100 Enter balance: 1000.11 Enter owner’ s name: Chewbacca Enter owner’s address: Starfleet 1 Menu 1- Enter data Eor specific account, 2-Display data or specific account 3-Display data for all accounts 4-Quit Enter account number: 500 Enter balance: 5000.5 Enter owner’s name: L Skywalker Enter owner’s address: Starfleet 2 Menu 1-Enter data Eor specific account, 2-Display data for specific account 3-Display data for all accounts , 4-Quit Account #: 100 Owner s name: Chewbacca Owner s address:Starfleet i Balance: 1000.11 Account #: 500 Owner’s name: L Skywalker Owner s address: Starfleet 2 Balance: 5000.5 Menu 1-Enter data Eor specific account, 2-Display data Eor specific account 3-Display data for all accounts ,4-Quit Output-10
Enter max number of accounts: 3 Menu: 1- Enter data for specific account, 2-Display data for specific account 3->Display data for all account 3 , 4->Quit: Enter account number 20 Enter balance: 201.25 Enter owner’s name: Mr. Chekov Enter owner’s address 3 Enterprise Menu: r data for specific account, 2-5Display data for specific account 3->Display data for all accounts 4-Quit: Enter account number 10 Enter balance: 123.45 Enter owner ‘s name Obi-Wan Enter owner ‘s address: 4 Enterprise Menu: 1->Enter data for specific account, 2->Display data for specific account 3->Display data for all account 3 , 4->Quit: 1 Enter account number 10 Duplicate account number Output-11

Leave a Reply

Your email address will not be published. Required fields are marked *