Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i have a compilation error. there is only one error. it saysundifined reference to 'Account::numberAccount ' //main.cpp #includeAccount.h #includeRegularAccount.h #includePremiumAccount.h int RegularAccount::numberRegularAccount=0; int PremiumAccount::numberPremiumAccount=0; double

i have a compilation error. there is only one error. it says"undifined reference to 'Account::numberAccount '

//main.cpp #include"Account.h" #include"RegularAccount.h" #include"PremiumAccount.h"

int RegularAccount::numberRegularAccount=0; int PremiumAccount::numberPremiumAccount=0; double PremiumAccount::MIN_BALANCE=1000;

int main() { const int MAX_NUM_REGULAR_ACCOUNTS=5; const int MAX_NUM_PREMIUM_ACCOUNTS=5; RegularAccount *regularAccountArray[MAX_NUM_REGULAR_ACCOUNTS]; PremiumAccount *premiumAccountArray[MAX_NUM_PREMIUM_ACCOUNTS];

double amount=-1; char *ownerName="something"; int accountNo=-1; int count=0; int index=-1; int ch=-1; while(ch!=8) { cout<<" .............................................................. "; cout<<" \t1) Create Regular Account."; cout<<" \t2) Create Premium Account."; cout<<" \t3) Deposit into Regular Account."; cout<<" \t4) Deposit into Premium Account."; cout<<" \t5) Withdraw from Regular Account."; cout<<" \t6) Withdraw from Premium Account."; cout<<" \t7) Display Information of all Accounts."; cout<<" \t8) QUIT"; cout<<" \t Enter Your Choice:"; cin>>ch; cout<<" .............................................................. "; switch(ch) { case 1: if(RegularAccount::getNumberRegularAccount()>ownerName; while(amount<0) { cout<<" \tEnter Initial Amount To Deposit:"; cin>>amount; if(amount<0) { cout<<"Invalid Amount..!!!(Amount should be greater then 0) "; } } regularAccountArray[RegularAccount::getNumberRegularAccount()]=new RegularAccount(ownerName,amount); } break; case 2: if(PremiumAccount::getNumberPremiumAccount()>ownerName; while(amount<1000) { cout<<" \tEnter Initial Amount To Deposit:"; cin>>amount; if(amount<1000) { cout<<"Invalid Amount..!!!(Amount should be greater then 1000) "; } } count=PremiumAccount::getNumberPremiumAccount(); premiumAccountArray[count]=new PremiumAccount(ownerName,amount); } break; case 3: accountNo=-1; index=-1; count=0; cout<<" \tEnter Account Number:"; cin>>accountNo; for(count=0;countgetAccountNumber()==accountNo) { index=count; break; } } if(index==-1) { cout<<" \tAccount Not Found"; } else { amount=-1; while(amount<0) { cout<<" \tEnter Enter Ammount To Deposit:"; cin>>accountNo; if(amount<0) { cout<<"Invalid Amount..!!!(Amount should be greater then 0) "; } } regularAccountArray[index]->deposit(amount); }

break; case 4: index=-1; count=0; cout<<" \tEnter Account Number:"; cin>>accountNo; for(count=0;countgetAccountNumber()==accountNo) { index=count; break; } } if(index==-1) { cout<<" \tAccount Not Found"; } else { amount=-1; while(amount<0) { cout<<" \tEnter Enter Ammount To Deposit:"; cin>>accountNo; if(amount<0) { cout<<"Invalid Amount..!!!(Amount should be greater then 0) "; } } premiumAccountArray[index]->deposit(amount); } break; case 5: accountNo=-1; index=-1; int count; cout<<" \tEnter Account Number:"; cin>>accountNo; for(count=0;countgetAccountNumber()==accountNo) { index=count; break; } } if(index==-1) { cout<<" \tAccount Not Found"; } else { cout<<" \tEnter Enter Ammount To Deposit:"; cin>>accountNo; if(amount<=regularAccountArray[index]->getBalance()) { cout<<"Invalid Amount..!!!(Amount should be less then "<getBalance()<<" "; } regularAccountArray[index]->withdraw(amount); } break; case 6: accountNo=-1; index=-1; count=0; cout<<" \tEnter Account Number:"; cin>>accountNo; for(count=0;countgetAccountNumber()==accountNo) { index=count; break; } } if(index==-1) { cout<<" \tAccount Not Found"; } else { amount=0; while(premiumAccountArray[index]->getBalance()>amount+PremiumAccount::getMinBalance()) { cout<<" \tEnter Enter Ammount To Deposit:"; cin>>accountNo; if(premiumAccountArray[index]->getBalance()>amount+PremiumAccount::getMinBalance()) { cout<<"Invalid Amount..!!!(Amount should be less then "<getBalance()<<" "; } } premiumAccountArray[index]->withdraw(amount); } break; case 7: if(Account::getnumberAccount()<1) { cout<<"No data Found"; } else { int count=0; int temp=0; temp=RegularAccount::getNumberRegularAccount(); cout<<"ACCOUNT NUMBER\tNAME\tBALANCE "; while(countgetAccountNumber()<<"\t"<getOwnerName()<<"\t"<getBalance()<getAccountNumber()<<"\t"<getOwnerName()<<"\t"<getBalance()<

} break; default: if(ch!=8) { cout<<" \tInvalid Choice...!!! "; } break; } } return 0; }

?----------------------------------------------------------------------------------------?----------------------------------------------------------------------------------------

?----------------------------------------------------------------------------------------?----------------------------------------------------------------------------------------

//Account.h

#ifndef ACCOUNT_H_INCLUDED #define ACCOUNT_H_INCLUDED #include #include #include #include using namespace std;

class Account { private: int accountNumber; char *ownerName; protected: double balance;

public: //static int numberAccount; static int numberAccount; Account(char *ownerName_,double balance_) { cout<<" Process in Account Class "; numberAccount++; accountNumber=balance_; strcpy(ownerName,ownerName_); accountNumber=numberAccount+1000; } virtual void withdraw(int amount) { this->balance-=amount; } void deposit(int amount) { this->balance+=amount; } int getAccountNumber() { return accountNumber; } int getBalance() { return balance; } char *getOwnerName() { return ownerName; } static int getnumberAccount() { return numberAccount; } virtual void print() { cout<<" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; cout<<" ---------------------------------------"; cout<<" \t\tACCOUNT DETAIL "; cout<<" ---------------------------------------"; cout<<" \tOwner:"<ownerName<accountNumber<balance<

#endif // ACCOUNT_H_INCLUDED

?----------------------------------------------------------------------------------------?----------------------------------------------------------------------------------------

?----------------------------------------------------------------------------------------?----------------------------------------------------------------------------------------

//RugularAccount.h

#ifndef REGULARACCOUNT_H_INCLUDED #define REGULARACCOUNT_H_INCLUDED

class RegularAccount:public Account { private: static int numberRegularAccount; public: //static int numberRegularAccount; RegularAccount(char *name,double amount):Account(name,amount) { numberRegularAccount++; } static int getNumberRegularAccount() { return numberRegularAccount; } void print() { cout<<" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; cout<<" ---------------------------------------"; cout<<" \t\tREGULAR ACCOUNT "; cout<<" ---------------------------------------"; cout<<" \tOwner:"<getOwnerName()<getAccountNumber()<balance<

#endif // REGULARACCOUNT_H_INCLUDED

?----------------------------------------------------------------------------------------?----------------------------------------------------------------------------------------

?----------------------------------------------------------------------------------------?----------------------------------------------------------------------------------------

//PremiumAccount.h

#ifndef PREMIUMACCOUNT_H_INCLUDED #define PREMIUMACCOUNT_H_INCLUDED

class PremiumAccount:public Account { private: static int numberPremiumAccount; static double MIN_BALANCE; public: //static int numberPremiumAccount; //static double MIN_BALANCE; PremiumAccount(char *name,double amount):Account(name,amount) { cout<<" Process in Premium Amount "; numberPremiumAccount++; } static int getNumberPremiumAccount() { return numberPremiumAccount; } void withdraw(int amount) { this->balance-=amount; } static double getMinBalance() { return MIN_BALANCE; } void print() { cout<<" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; cout<<" ---------------------------------------"; cout<<" \t\tPREMIUM ACCOUNT "; cout<<" ---------------------------------------"; cout<<" \tOwner:"<getOwnerName()<getAccountNumber()<balance<

#endif // PREMIUMACCOUNT_H_INCLUDED

?----------------------------------------------------------------------------------------

?----------------------------------------------------------------------------------------

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Outlook 2023

Authors: James Holler

1st Edition

B0BP9P1VWJ, 979-8367217322

More Books

Students also viewed these Databases questions

Question

Is it clear what happens if an employee violates the policy?

Answered: 1 week ago