51 lines
940 B
C++
51 lines
940 B
C++
//account class file
|
|
#include <iostream>
|
|
using namespace std;
|
|
|
|
class account
|
|
{
|
|
public:
|
|
|
|
account(short set_pin)
|
|
{
|
|
pin = set_pin;
|
|
}
|
|
|
|
void deposit(double deposit)
|
|
{
|
|
balance += deposit;
|
|
cout << "Succesfully deposited $" << deposit << endl;
|
|
cout << "New balance is: $" << balance << endl << endl;
|
|
}
|
|
|
|
|
|
void withdraw(double withdrawl)
|
|
{
|
|
if (balance - withdrawl < 0) {
|
|
cout << "Error: Not enough money in balance";
|
|
}
|
|
|
|
else
|
|
{
|
|
balance -= withdrawl;
|
|
cout << "Succesfully withdrew $" << withdrawl << endl;
|
|
cout << "New balance is: $" << balance << endl << endl;
|
|
}
|
|
}
|
|
|
|
void set_bal(double new_bal) { balance = new_bal; }
|
|
bool test_pin(short int pin_attmpt) {
|
|
if (pin_attmpt == pin)
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
void set_pin(short int new_pin) { pin = new_pin; }
|
|
void printBal() { cout << "$" << balance << endl << endl; }
|
|
double txt_file_bal() { return balance; }
|
|
private:
|
|
double balance;
|
|
short acnt_num;
|
|
short int pin;
|
|
};
|