1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#include <iostream>
#include <string>
using namespace std;
class Account{
protected:
string firstname;
string lastname;
int accountnumber;
double balance;
public:
Account();
Account(string FName,string LName,int accno,double bal);
void setAccountNumber(int accno);
void setBalance(double bal);
void setWithdraw(int wdraw,double bal);
void setDeposit(int dep,double bal);
double getBalance();
string getFullName(string fName,string lName);
void display(string FName,string LName);
};
Account::Account(){
firstname="Raaj";
lastname="Lokanathan";
accountnumber=5671;
balance=0.0;
}
Account::Account(string FName,string LName,int accno,double bal){
firstname = FName;
lastname = LName;
accountnumber = accno;
balance = bal;
}
void Account::setAccountNumber(int accno){
accountnumber = accno;
}
void Account::setBalance(double bal){
balance = bal;
}
void Account::setWithdraw(int wdraw,double bal){
if(bal>=wdraw){
wdraw=bal-wdraw;
cout<<"Your current balance is: "<<wdraw<<endl;
}else{
cout<<"No money"<<endl;
}
}
void Account::setDeposit(int dep,double bal){
dep=dep+bal;
cout<<"Your current balance is: "<<dep<<endl;
}
double Account::getBalance(){
return balance;
}
string Account::getFullName(string FName,string LName){
string FullName,x=" ";
LName=x+LName;
return FullName=FName+LName;
}
void Account::display(string FName,string LName){
cout<<"First Name: "<<FName<<endl;
cout<<"Last Name: "<<LName<<endl;
cout<<"Full Name: "<<getFullName(FName,LName)<<endl;
cout<<"Account Number: "<<accountnumber<<endl;
cout<<"Current Balance: "<<balance<<endl;
}
|