#include<iostream>
#include<string>
usingnamespace std;
class Bank_Account //name of the class
{
private:
string name; //attributes to the private so its protected
int acct_num;
int pin_num;
double Balance;
public:
void setName (string); //for name to store
string getName (); //for name to store and retrive name
void setAcctnum (int);//account num to store
double getAcctnum (); //acct num for retrive acct number
double getBalance ();//retrieve the balance
bool setPIN (int); // to store number
double checkPIN(); // receives a PIN number as parameter, returns TRUE if it matches the PIN in the object
void deposit(); // Receives amount of money to deposit.If this amount is valid (positive) then + to balance. Otherwise do nothing. No return value.
void withdraw(); // Receives amount of money to withdraw. If this amount is valid(positive) then make sure there are funds to cover the withdrawl.
//If so then subtract from balance. If not enough money then printthe message “Insufficent funds” and make no changes. No return value
Bank_Account()
{
Balance=0; //balance needed to intialized
}
Bank_Account (double B)
{
Balance=B;
}
};
void Bank_Account::setName (string Bname)
{
name=Bname;
}
string Bank_Account::getName ()
{
return name;
}
void Bank_Account::setAcctnum (int AN)
{
acct_num=AN;
}
double Bank_Account::getAcctnum ()
{
return acct_num;
}
double Bank_Account::getBalance ()
{
return Balance;
}
bool Bank_Account::setPIN (int PN)
{
pin_num=PN;
}
double Bank_Account::checkPIN()
{
if(PN==true)
{
returntrue;
}
else
{
returnfalse;
}
}
int main()
{
Bank_Account ob;
string n;
int a;
int p;
cout<<"what is your name?";
cin>>n;
ob.setName(n);
cout<<"what is the bank account info?";
cin>>a;
cout<<"What is the pin number you choose?";
cin>>p;
ob.setPIN(p);
return 0;
}
// receives a PIN number as parameter, returns TRUE if it matches the PIN in the
//this function receives a parameter and returns a bool.
///double checkPIN(); change this double to bool
bool Bank_account::checkPIN(int pin)
{
return (pin==pin_num);
}