Skip to content

PayPeriodsPerYear

This property numerically defines the pay period to be used in calculations. This value defaults to 12, which corresponds to a monthly pay period. The Earnings property and the TaxAmount method are expressed in terms of this same pay period.

For example, suppose we have

// using TaxControls;
try {
CTaxControl tc = new CTaxControl();
tc.DataFilename = "us.dat";
tc.SelectedTax = "fit";
// 12 for monthly:
tc.PayPeriodsPerYear = 12;
tc.Earnings = 1000.00;
Console.WriteLine(jc.TaxAmount());
} catch (TaxControlException e) {
Console.WriteLine(e.Message);
}
//import com.boondocks.taxcontrols.*;
try {
tc.setDataFilename("us.dat");
tc.setSelectedTax("fit");
// 12 for monthly:
tc.setPayPeriodsPerYear(12);
tc.setEarnings(1000.00);
System.out.println(tc.TaxAmount());
} catch (TaxControlException e) {
e.printStackTrace();
}

giving a TaxAmount of $150. The Earnings and TaxAmount are both considered monthly figures.

If we were to change PayPeriodsPerYear to 24:

// using TaxControls;
try {
TaxControl tc = new TaxControl();
tc.setDataFilename("us.dat");
tc.setSelectedTax("fit");
// now 24 for semi-monthly:
tc.setPayPeriodsPerYear(24);
tc.setEarnings(1000.00);
Console.WriteLine(jc.TaxAmount());
} catch (TaxControlException e) {
Console.WriteLine(e.Message);
}
//import com.boondocks.taxcontrols.*;
try {
tc.setDataFilename("us.dat");
tc.setSelectedTax("fit");
// 24 for semi-monthly:
tc.setPayPeriodsPerYear(24);
tc.setEarnings(1000.00);
System.out.println(tc.TaxAmount());
} catch (TaxControlException e) {
e.printStackTrace();
}

the $1000 Earnings value would now correspond to a semi-monthly figure, and TaxAmount would produce a new semi-monthly tax figure, in all likelihood not $150. (This is because many taxes are based on brackets which determine the tax rate.)

Syntax

value = object.

object. value

Part Description
object A TaxControl object.
value An integer result/expression.