This homework assignment gives you the opportunity to practice classes, member variables, member functions, static member variables, dynamic creation of objects, pointers to objects. The homework has an extra credit version worth an additional 15 bonus points.
Design a bank account class named Account that has the following private member variables:
and the following public member functions:
Demonstrate in a program.
Your code should be structured into the following files, but you should turn in only Account.cpp and main.cpp:
member functions)
Define a global array of pointers to Account, of size MAX_NUM_ACCOUNTS (set MAX_NUM_ACCOUNTS to 4)
Account * accountArray[MAX_NUM_ACCOUNTS];
In main, initialize all the elements of the above array with nullptr Loop on displaying the following menu of choices:
If the user selects “Create account” on the menu, the program will prompt the user to enter the number of owners and the amount, dynamically allocate an Account object, and store the address of the created object into the first available element of the array of pointers, starting with the one at index 0. Then, owner by owner, the program prompts the user to enter the owner’s info (name, DOB, address) and calls the setOwner mutator to set the owner’s info. If there is no
more available element (i.e. the array is full), no dynamic allocation of an Account object is done, and an error message is displayed. The account number is automatically generated from the static variable accountCounter.
If the user selects “Deposit”, or “Withdraw”, the program prompts the user to enter the account number and amount and checks that the account number exists. If so, it calls the appropriate member function(s). The appropriate error message is printed if an error indication is returned by the member function.
Choices 5, 6 and 7 are placeholders for the extra credit version. For the basic version, if the user selects 5, 6 or 7, the
program does nothing and displays the menu again.
If the user selects “Quit”, the main function should release the dynamically allocated Account objects and terminate.
specific error message (“Maximum number of accounts reached”)
The extra credit is a superset of the basic version.
Define a global array of pointers to Account, of size MAX_NUM_ACCOUNTS (set MAXNUMACCOUNTS to 4) Account * accountArray[MAXNUMACCOUNTS];
In main, initialize all the elements of the above array with nullptr Loop on displaying the following menu of choices:
If the user chooses 1, 2, 3, 4, or 8, the program should behave like in the basic version. If the user chooses 5, the user will be prompted for the account number and the Person to delete. Delete is not performed if there is only one owner in the account. If the user chooses 6, the user will be prompted for the account number and the Person to add. You are
not required to check that Person is already an owner of the account. If the user chooses 7, the user will be prompted for the account to delete. The program prints an error message if the account is not found.
Implement these additional public member functions:
A new array of the right size should be dynamically allocated, all the owner’s info from the current array should be
copied to the new array and the current array released. You are not required to check that Person is already an owner of the account. The relative order of the owners should be preserved, and the newly added owner should be last in the
new array.
size should be dynamically allocated, all the owner’s info from the current array should be copied to the new array and the current array released. The relative order of the owners should be preserved in the new array.
In addition, when the user chooses “Delete account”, the main function should print an error message if the account is not found. Otherwise, delete is performed and all the relevant data should be updated. The Account object should be released. The "Delete account" operation should not result in any gap in the accountArray array, and should preserve the relative order of the elements in the array.
Style: 10 points (refer to the “Homework Notes” for the style requirements)
Required: Dynamic allocation of Account and assignment to the proper element of the accountArray when an account is created: Deduct 10 points if the requirement is not met
Required: Dynamic allocation of Person array of the right size in Account constructor: Deduct 10 points if the requirement is not met
Required: Use of static variable for accountCounter: Deduct 5 points if the requirement is not met
Test-1 – Basic case, no error – Output matches output-1: 42 points
Test-2 – withdraw and deposit, Account does not exist – Output matches output-2: 9 points Test-3 – Max number of accounts reached – Output matches output-3: 9 points
Test-4 – withdraw, invalid amounts – Output matches output-4: 9 points Test-5 – deposit, invalid amount - Output matches output-5: 9 points
Test-6 – delete account (Extra credit) – Output matches output-6: 5 points Test-7 – Account-set-getOwners unit tests: 12 points
Test-8 – addOwner unit test (Extra credit): 5 points Test-9 – delOwner unit test (Extra credit): 5 points
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme