Input: Design a bank account class named Account that has the following private
ID: 3829171 • Letter: I
Question
Input: Design a bank account class named Account that has the following private member variables: account of type int Number owner Name of type string balance of type double and the following public member functions: Account constructor with no arguments, that creates a bank account with a default accountNumber as 9999, a name of an empty string, and balance value of zero. An Account object is dynamically allocated Account (number name, bal) constructor with three parameters, that creates a bank account with a specified accountNumber, name and balance. An Account object is dynamically allocated withdraw (amount) 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. deposit (amount) 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. getAccountNumber An accessor function that returns the account number, This function is later called by the displayAccountInfo function. getName O: An accessory function that returns the name on the account get Balance An accessor function that returns the account balance. This function is later called by the displayAccountInfo0 function. Demonstrate the class in a program. 1. 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.Explanation / Answer
/* *******Account.h **************** */
#ifndef ACCOUNT_DEFINED
#define ACCOUNT_DEFINED 1
class Account
{
int accountNumber;
string ownerName;
double balance;
public :
void Account();
void Account(int accountNumber,string ownerName,double balance);
bool withdraw(double amount);
bool deposit(double amount);
int getAccountNumber();
string getName();
double getBalance();
};
#endif
/* ************************** END Account.h *********** */
/* *********Account.cpp*************** */
#include "Account.h"
#include <iostream.h>
void Account :: Account()
{
accountNumber=9999;
ownerName='';
balance=0.0;
}
void Account :: Account(int actNumber,string ownrName,double blnc)
{
accountNumber=actNumber;
ownerName=ownrName;
balance=blnc;
}
void Account :: withdraw(double amount){
if (balance >= amount)
{
balance -= amount;
}
else
{
return false;
}
return true;
}
bool Account::deposit(double amount)
{
if(amount<=0){
return false;
}else{
balance += amount;
}
return true;
}
int getAccountNumber(){
return accountNumber;
}
string getName(){
return ownerName;
}
double getBalance(){
return balance;
}
/* **************** END Account.cpp ******** */