Created
June 26, 2022 11:11
-
-
Save AhmedTarekHasan/55b14c3b0fc7fea887fb51ea7dd8abb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TaxCalculator1 : TaxCalculator | |
{ | |
protected override bool CanCalculateExpenses => false; | |
protected override bool CanCalculateIncomeTax => true; | |
protected override bool CanCalculateVat => false; | |
// No logic to apply. Therefore, just return 0. | |
protected override decimal CalculateExpenses(decimal input) | |
{ | |
return 0; | |
} | |
protected override decimal CalculateIncomeTax(decimal income) | |
{ | |
return income + 100; | |
} | |
// No logic to apply. Therefore, just return 0. | |
protected override decimal CalculateVat(decimal vat) | |
{ | |
return 0; | |
} | |
} | |
public class TaxCalculator2 : TaxCalculator | |
{ | |
protected override bool CanCalculateExpenses => true; | |
protected override bool CanCalculateIncomeTax => false; | |
protected override bool CanCalculateVat => false; | |
protected override decimal CalculateExpenses(decimal input) | |
{ | |
return input + 120; | |
} | |
// No logic to apply. Therefore, just return 0. | |
protected override decimal CalculateIncomeTax(decimal income) | |
{ | |
return 0; | |
} | |
// No logic to apply. Therefore, just return 0. | |
protected override decimal CalculateVat(decimal vat) | |
{ | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment