-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentLoanDeductor.cpp
More file actions
31 lines (26 loc) · 874 Bytes
/
Copy pathStudentLoanDeductor.cpp
File metadata and controls
31 lines (26 loc) · 874 Bytes
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
#include "StudentLoanDeductor.h"
namespace UKTax
{
namespace Deductors
{
double StudentLoanDeductor::Deduct(double amount)
{
if (0.0 >= amount)
return amount;
TaxDatabase* database = TaxDatabase::Instance();
const StudentLoanTax& studentLoanTax = database->GetStudentLoanTax(this->plan);
const double band = studentLoanTax.GetBand();
const double rate = studentLoanTax.GetRate();
/*
* Student loan repayment is calculated on the
* gross salary but taken from net salary...
*/
if (gross > band)
{
std::cerr << "\nStudent Loan Tax:\n" << "Total amount taxed: " << (gross - band) << "\nTotal tax: " << (rate * (gross - band)) << std::endl;
amount -= BaseTaxDeductor::TaxForAmount(band, gross, rate);
}
return BaseTaxDeductor::Deduct(amount);
}
};
};