#include "penalty_1.h"

// Author: Steve Talbot

penalty_1:: penalty_1(){
}

penalty_1:: ~penalty_1(){
}

bool penalty_1:: 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 );

	return true;

}
