Question: Need help please!.. C++ program Design a bank account class named Account that has the following private member variables: accountNumber of type int ownerName of

Need help please!.. C++ program

Design a bank account class named Account that has the following private member variables: accountNumber of type int ownerName of type string balance of type double transactionHistory of type pointer to Transaction structure (structure is defined below) numberTransactions of type int totalNetDeposits of type static double.The totalNetDeposits is the cumulative sum of all deposits (at account creation and at deposits) minus the cumulative sum of all withdrawals. numberAccounts of type static int

and the following public member functions: Account(number, name, amount, month, day, year) is the constructor that initializes the accounts member variables with number, name and amount. amount is the amount deposited when the account is created. The account creation transaction is recorded in the transaction history by calling recordTransaction. numberTransactions is set to 1, and amount is added to totalNetDeposits. numberAccounts is incremented. withdraw(amount, month, day, year) function to withdraw a specified amount from the account. The function should first check if there is sufficient balance in the account. If the balance is sufficient, withdrawal is processed. Otherwise the withdrawal is not made. If the withdrawal is made, the withdrawal amount is deducted from balance and from totalNetDeposits. The transaction is recorded in the transaction history. numberTransactions is incremented. deposit(amount, month, day, year) function to deposit a specified amount of money to the account. The function should first check if the deposit amount is positive. If it is positive, deposit is processed. Otherwise the deposit is not made. If the deposit is made, the amount is added to balance and to totalNetDeposits, and the transaction is recorded in the transaction history. numberTransactions is incremented. getAccountNumber(): An accessor function that returns the account number. This function is later called by the displayAccountInfo() function. getName(): An accessor function that returns the name on the account. getBalance(): An accessor function that returns the account balance. This function is later called by the displayAccountInfo() function. printTransactions: prints the history of transactions: date (month, year, day), amount and type for each transaction getTotalNetDeposit(): A static member function that returns totalNetDeposits.

Demonstrate the class in a program. 2. Transaction structure Transaction structure has the following members: transactionMonth of type Month transactionDay of type int transactionYear of type int transactionAmount of type double transactionType of type Operation Operation is of type enum, and the possible values are CREATION, DEPOSIT, WITHDRAWAL.

3. Record a Transaction in history To record a transaction, you should implement recordTransaction, a private member function, which takes as argument a Transaction to be recorded. The transaction history is implemented as an array of Transaction structures. Initially, the history is empty and no array is allocated. The first transaction is recorded in the history (account creation is the first transaction) by dynamically allocating an array of size 1, and populating with the transaction to be recorded.

/* This function takes as argument a Transaction structure and adds it to the transaction history. The transaction history is implemented as an array of Transaction structures. A new array is dynamically allocated, of size equal to (size of old array)+1, to hold the added transaction. The values of the old array are copied into the new array,and the transaction to be added is copied into the last element of the new array.The old array is released through delete. The address returned from dynamic array allocation is assigned to transactionHistory.

*/ void Account::recordTransaction(Transaction transact) { // Function body }

4. Additional Requirements a) What to turn in Your code should be structured into the following files: Account.h which contains the class definition and the function prototypes of all the member functions Account.cpp which contains the function description of all the member functions Main.cpp file which contains the main function. b) Outline of main Define a global array of pointers to Account, of size NUM_ACCOUNT (set NUM_ACCOUNT to 5). Loop on displaying the following menu of choices: 1. Create account (user will be prompted for account number, name, amount, month, day and year) 2. Deposit to account (user will be prompted for account number, amount, month, day and year) 3. Withdraw from account (user will be prompted for account number, amount, month, day and year) 4. Print transaction history (user will be prompted for account number) 5. Display information for all accounts (including the transaction history) 6. Display totalNetDeposits 7. Exit the program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!