-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeductorBuilder.h
65 lines (56 loc) · 1.45 KB
/
DeductorBuilder.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once
#include "NationalInsuranceDeductor.h"
#include "IncomeTaxDeductor.h"
#include "StudentLoanDeductor.h"
/**
* Builder class for building tax deductors.
*
* @author Gary Hannah
*/
namespace UKTax
{
namespace Deductors
{
class DeductorBuilder
{
private:
/*
* Some taxes differ by region (income tax).
*/
TaxDatabase::UKRegion region;
/*
* If student loan deductor is required,
* it needs to know the student loan plan.
*/
TaxDatabase::StudentLoanPlan plan;
/*
* Do we need a student loan deductor?
*/
bool hasStudentLoan;
/*
* Some types of tax determine if tax is necessary based on
* the gross amount (and not the net amount after other taxes
* have been deducted), and some calculate the amount to deduct
* on the gross and not the current net.
*/
double gross;
/*
* Both must be true when we call Build()
*/
bool gotGross;
bool gotRegion;
public:
DeductorBuilder() :
gross(0.0),
region(TaxDatabase::UKRegion::eAllRegions),
hasStudentLoan(false),
gotGross(false),
gotRegion(false)
{}
DeductorBuilder* SetGross(double);
DeductorBuilder* SetRegion(TaxDatabase::UKRegion);
DeductorBuilder* SetStudentLoanPlan(TaxDatabase::StudentLoanPlan);
std::unique_ptr<BaseTaxDeductor> Build();
};
};
};