#include "penalty_2.h"

// Author: Steve Talbot

penalty_2:: penalty_2(){
}

penalty_2:: ~penalty_2(){
}

bool penalty_2:: penalty( Data* data_ ){

	AccountInfo* accountInfo = data_->getCurrentAccountInfo();

	// update “accountInfo” to track that account is “overdrawn” ..
	if( accountInfo->getIsOverdrawn () == false )
		accountInfo->setIsOverdrawn( true );

	int currentBalance = accountInfo->getB();

	int penaltyAmount = data_->getOverdrawPenalty();

	int result = ( currentBalance - penaltyAmount );

	// update the “account” with the new balance ..
	accountInfo->setB( result );

	// alternate configuration:
	cout << "overdraw penalty charged: " << penaltyAmount << endl;

	return true;

}
