Please follow the instructions and meet all the requirements. Please enter the i
ID: 3726422 • Letter: P
Question
Please follow the instructions and meet all the requirements. Please enter the inputs in the screenshot to see if you got the same outputs as are in the screenshot. Thanks.
HW7 (Graded out of 100) Design a bank account class named Account that has the following private member variables: accountNumber of type int numOwners of type int // number of account co-owners (account can have more than one owner) ownerPtr of type Person //, ownerPtr points to an array of Person, where Person is a structure. The Person structure is defined below accountCounter of type static int // initialized at 1000, incremented at each account creation, used to automate account number assignmentExplanation / Answer
The below code is suitable for the question please check and give positive rating
account.h
#ifndef account_h_
#define account_h_
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
class account
{
public:
//----------------------------------------------------
//account
account();
account(const std::string acctnum);
~account();
//----------------------------------------------------
//account number
inline const std:string get_acctnum() const{
return m_acctnum;
}
//----------------------------------------------------
//deposit
inline deposit(){
deposit(15);
}
//----------------------------------------------------
//withdraw
void withdraw(){
withdraw(3);
}
//----------------------------------------------------
//current balance
inline const double get_balance() const{
return m_balance;
})
//----------------------------------------------------
//display string
const std::string asString() const;
private:
//----------------------------------------------------
//account number
int m_acctnum;
//----------------------------------------------------
//balance
double m_balance;
};
#endif
account.cpp
#include <iostream>
#include <string>
#include <stdlib.h>
#include "account.h"
using namespace std;
//----------------------------------------------------
//bank account default balance
account::account(){
m_balance = 0;
m_acctnum = "???";
}
account::account(const std::string acctnum){
m_balance = 0;
m_acctnum = acctnum;
}
account::~account(){
}
//----------------------------------------------------
//deposit
void account::deposit(double amount){
balance = balance + amount;
}
//----------------------------------------------------
//withdraw
void account::withdraw(double amount){
if(amount < balance ){
std::cout << "Debit amount exceeded account balance."
<< amount << endl;
}
else if(amount < 0){
std::cout <<"The withdrawel you've enter is defined as negative."
<< amount << endl;
}
else{
balance = balance - amount;
}
}
//----------------------------------------------------
//get balance
double account::get_balance() const{
return balance;
}
//----------------------------------------------------
//display
const std::string account::asstring() const{
ostringstream oss;
oss << "Account Num: " << m_acctnum <<
" Balance: " << m_balance;
return oss.str();
}
Problem file
#include <stdlib.h>
#include <iostream>
#include <string>
#include "account.h"
void main(){
//define bank accounts
acct (923, 0);
acct (124, 100);
}