Commit 55265f3
Changed files (2)
assignments
assignment1
src
main
java
ca
mokhan
assignment1
test
java
ca
mokhan
assignment1
assignments/assignment1/src/main/java/ca/mokhan/assignment1/TaxReturn.java
@@ -44,10 +44,10 @@ public class TaxReturn {
private static final double RATE1 = 0.15;
private static final double RATE2 = 0.28;
private static final double RATE3 = 0.31;
- private static final double SINGLE_BRACKET1 = 21450;
- private static final double SINGLE_BRACKET2 = 51900;
- private static final double MARRIED_BRACKET1 = 35800;
- private static final double MARRIED_BRACKET2 = 86500;
+ public static final double SINGLE_BRACKET1 = 21450;
+ public static final double SINGLE_BRACKET2 = 51900;
+ public static final double MARRIED_BRACKET1 = 35800;
+ public static final double MARRIED_BRACKET2 = 86500;
private double income;
private int status;
assignments/assignment1/src/test/java/ca/mokhan/assignment1/TaxReturnTest.java
@@ -13,7 +13,35 @@ public class TaxReturnTest extends TestCase {
return new TestSuite(TaxReturnTest.class);
}
- public void testTrue() {
- assertTrue(true);
+ public void test_SINGLE_BRACKET1() {
+ assertEquals(
+ 3217.4985, new TaxReturn(TaxReturn.SINGLE_BRACKET1 - 0.01, TaxReturn.SINGLE).getTax());
+ }
+
+ public void test_SINGLE_BRACKET2() {
+ assertEquals(
+ 11743.4972, new TaxReturn(TaxReturn.SINGLE_BRACKET2 - 0.01, TaxReturn.SINGLE).getTax());
+ }
+
+ public void test_SINGLE_BRACKET3() {
+ assertEquals(
+ 11743.5031, new TaxReturn(TaxReturn.SINGLE_BRACKET2 + 0.01, TaxReturn.SINGLE).getTax());
+ }
+
+ public void test_MARRIED_BRACKET1() {
+ assertEquals(
+ 5369.9985, new TaxReturn(TaxReturn.MARRIED_BRACKET1 - 0.01, TaxReturn.MARRIED).getTax());
+ }
+
+ public void test_MARRIED_BRACKET2() {
+ assertEquals(
+ 19565.997200000005,
+ new TaxReturn(TaxReturn.MARRIED_BRACKET2 - 0.01, TaxReturn.MARRIED).getTax());
+ }
+
+ public void test_MARRIED_BRACKET3() {
+ assertEquals(
+ 19566.003099999998,
+ new TaxReturn(TaxReturn.MARRIED_BRACKET2 + 0.01, TaxReturn.MARRIED).getTax());
}
}