checkpin

can someone help with checkpin function please. the pin needs to be true with what you entered. and im having little difficult time

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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
  #include<iostream>
#include<string>
using namespace 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)
    {
        return true;
        
    }
    else
    {
        return false;
    }
}

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;
   
   
}
closed account (SECMoG1T)
1
2
3
4
5
6
7
8
9
// 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);
}
Topic archived. No new replies allowed.