//account.cpp
#include "account.h"

//Initializing account entities
Account::Account(char fn[], char ln[], char sin[], double bal, int actype, int trans)
{
	strcpy(firstName, fn);
	strcpy(lastName, ln);
	strcpy(sinNumber, sin);
	balance = bal;
	accountType = actype;
	transactions = 0;
};


//Choose the account
string Account::getAccountType()
{
  if (accountType == 1)
  {
    return "Account Type: Chequing";
  }
  else
  {
    return "Account Type: Savings";
  }
};

//Despoit amount to account of user, will return the balance now
double Account::DepositAmt(double amount) 
{
	if (amount < 0)
	{
		cout << "You cannot deposit a negative balance!" << endl;
		return -1;
	}
	
	//the initial balance will be added to the amount deposited
	balance = balance + amount;
	
	return balance;
	
};

//Withdrawal amount from account of user
double Account::WithdrawAmt(double withdrawal)
{

	//Withdraw more than balance, cause error
	if (withdrawal > balance)
	{
	
		cout << "Sorry the withdrawal amount exceeds the account balance" <<endl;
		return balance;
	}
		
	//withdrawal will deduct from the current balance.
	balance = balance - withdrawal;
	
	return balance;
	
};


//Get final balance after withdrawal
 double Account::getFinalBalance(double fbal)
{
		//this will return the remaining amount
		return balance;
};



//Print remaining balance 
void Account::PrintStatement()
{

		cout << "First Name:    " << firstName    << endl;
		cout << "Last Name:     " << lastName     << endl;
		cout << "SIN Number:    " << sinNumber    << endl;
		cout << "Account Type:  " << accountType  << endl;
		cout << "Final Balance: " << balance      << endl;
		cout << "Transactions:  " << transactions << endl;


};