Question: Please refer to the image for the question Problem Statement: In this homework, you will write a complete C++ program that will display a menu
Please refer to the image for the question
Problem Statement: In this homework, you will write a complete C++ program that will display a menu and based on user input, perform a variety of operations for bank account system. This is an individual work. Program Requirements: 1. You will create an Account class that defines public and private data members and member functions, including constructors/destructor, an overloaded operator etc. o Public member functions A default constructor, a destructor, a copy constructor, and a copy assignment. Mutators/accessors for the private data members. Deposit for depositing amount into the account. Withdraw for withdrawing amount from the account. An overloaded operator += to support a transfer from one bank account to another. For example, this operation may be done using the following code: destAcct += srcAcct where destAcct is an object of a destination bank account and srcAcct is an object of a source bank account. You will prompt the user for and read in the actual amount of money to transfer. See sample output. o Private data members Integer pointer account id. This will hold the address of dynamic memory containing account id. String customer name. Float balance. o Any other data member (s), and/or methods/mutators/accessors needed for your implementation. 2. You will create an Accounts class which is a container class for the Account objects. This means, the Accounts class holds multiple elements of Account objects. DO NOT use STL container classes (such as vector, list etc.) to implement this class. No STL is allowed for this homework. o Public member functions Default constructor Allocate memory for dynamic array of size defined by the maximum size (private data member) and initialize size to zero. Destructor Deallocate memory which is allocated in the constructors and reset size (counter).
Add account into the array takes an object of an Account class as an argument (pass by reference). Find an object of Account class in the dynamic array based on the account id takes account id as an argument. at method which returns a refence of an element (i.e., an object of Account class) in the dynamic array at given index. Account& at(const int i) const; o Private data members Constant integer maximum size (1000) for the dynamic array. Account pointer variable that points to an (first) object of dynamic array of accounts. Integer size a counter variable to count the number of accounts added so far in the dynamic array. o Any other data member (s), and/or methods/mutators/accessors needed for your implementation. 3. You will create an AccountSystem class to provide bank account system operations such as adding new account, deposit, withdraw, transfer, and printing all accounts. o Public member functions Add an account You will prompt the user for and read in the account id, customer account name, and initial deposit amount. Create an object of Account and set all the account information using mutators of the Account object and add the object in the Account container (accts). If the account id is already existed in the container, then print a meaningful error message. Do not add new account in this case. If successful, you will print a status message with the account details, formatting any monetary values to dollars and cents with 2 decimal places. Deposit You will prompt the user for and read in the account id and deposit amount to handle deposit operation. If the account is not available in the container based on the account id, then print an error message for failed deposit operation. If successful, you will print a status message with the account detail, formatting any monetary values to dollars and cents with 2 decimal places. Withdraw You will prompt the user for and read in the account id and withdraw amount to handle withdraw operation.
If the account is not available in the container based on the account id, then print an error message for failed withdraw operation. If enough balance is not available in the account to withdraw, then print an error message for failed withdraw operation. If successful, you will print a status message with the account detail, formatting any monetary values to dollars and cents with 2 decimal places. Transfer You will prompt the user for and read in source account id, destination account id, and transfer amount to handle transfer operation. If either source or destination account id is not available in the container, then print an error message for failed transfer operation. If enough balance is not available in the source account to transfer the amount, then print an error message for failed transfer operation. If successful, you will print a status message with the account detail, formatting any monetary values to dollars and cents with 2 decimal places. Print all accounts You will print a formatted list of all accounts, including the account id, customer account name, and balance. If there are no accounts, then you will print a meaningful message that there are no accounts. o Private data member An Accounts (container) variable to hold all the accounts. Accounts accts; o Any other data member (s), and/or methods/mutators/accessors needed for your implementation. 4. Implementation of main function (in main.cpp) consists of: o As with all homeworks in this course, your programs output will display your name, your EUID, your e-mail address, the department name, and course number. This means that your program will print this information to the terminal (see Sample Output). o You will declare and use an object of AccountSystem class. This class contains all the operations required to implement bank account system. The main function just calls the methods of the object of AccountSystem class to implement different transactions (add new account, deposit, withdraw, transfer, print accounts). o In a loop of your choice, you will repeatedly display a menu of options until the user enters the selection to terminate the program as follows: 1. Add new account 2. Deposit into account 3. Withdraw from account 4. Transfer into account
5. Print a list of all accounts 6. End transaction (Exit) o Although you may assume that the user enters an integer in response to this menu, the integer may be out of range. If the user enters an invalid menu option (i.e., not an integer between 1 and 6, inclusively), your program will display an error message and re-display the menu. o For each of the menu options except the 6. End transaction (Exit)" option, you will call the member function of the instance of the AccountSystem. Yu will display a meaningful message that the program is terminating and exit the program for 6. End transaction (Exit)". o After performing an operation from the menu, you will re-display the menu and accept new user input to perform another operation, thus repeating the process (except in the case of option 6 where the user wants to terminate the program). 5. You will create a makefile for compiling your source code, including a clean directive. When using g++ to compile your source code, use the -Wall switch to ensure that all warnings are displayed. Your code should compile with no warnings. Design Document: In your design document, you will be needed to turn in the following: 1. A single class diagram showing only the relationships between the entities. 2. A set of three individual class diagrams showing the attributes and methods for each of the classes in #1. 3. Step by Step pseudo code algorithms for every method defined in every class in the diagram from #1. Pseudo code for the mutators and accessors of the classes are not required (i.e., sets and gets).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
