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
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. Program Requirements: 1. You will create an Account class that defines public and private data members and memberfunctions, 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. 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. 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 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). General Requirements: Perform needed error handling, such as attempting to perform an operation on an empty list by displaying an error message instead of actually performing the operation The program will also be graded based upon your program style. This means that you should use comments (as directed), meaningful variable names, and a consistent indentation style. The code should be well documented in terms of comments. For example, good comments in general consist of a header (with your name, course section, date, and brief description), comments for each variable, and commented blocks of code. Submission: For each class, you will need to declare your class in .h file and define your class in .cpp file. So, there will be 3 header files (Account.h, Accounts.h, AccountSystem.h), 3 cpp files (Account.cpp, Accounts.cpp, AccountSystem.cpp), and one main.cpp. At least seven source code files are required but you can add more source code files as needed for your implementation.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
