diff options
| author | mokha <mokha@cisco.com> | 2019-05-05 19:57:14 -0600 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2019-05-05 19:57:14 -0600 |
| commit | 7b4cb6a2eef3a0fcde7e998832427c73599e4a0a (patch) | |
| tree | 75acc7cd8f3bd8a087e909db182c9e18a66879a1 /src/section-2 | |
| parent | 99a28d2dba93642e89a62ecf905a3bd4f138318d (diff) | |
use the exact naming convention for directories described by instructor
Diffstat (limited to 'src/section-2')
| -rw-r--r-- | src/section-2/BonusOnSavings.java | 36 | ||||
| -rw-r--r-- | src/section-2/BonusOnSavingsTest.java | 26 |
2 files changed, 0 insertions, 62 deletions
diff --git a/src/section-2/BonusOnSavings.java b/src/section-2/BonusOnSavings.java deleted file mode 100644 index 41090ec..0000000 --- a/src/section-2/BonusOnSavings.java +++ /dev/null @@ -1,36 +0,0 @@ -package ca.mokhan.assignment1; - -public class BonusOnSavings { - double annualRate = 0.0; - double quarterlyRate = 0.0; - - public BonusOnSavings() { - this(0.03, 0.05); - } - - public BonusOnSavings(double quarterlyRate, double annualRate) { - this.quarterlyRate = quarterlyRate; - this.annualRate = annualRate; - } - - public double computeBonus(double monthlyCommitment, double q1, double q2, double q3, double q4) { - double quarterlyTarget = monthlyCommitment * 3; - double annualTarget = monthlyCommitment * 12; - - return this.quarterlyBonus(quarterlyTarget, q1) - + this.quarterlyBonus(quarterlyTarget, q2) - + this.quarterlyBonus(quarterlyTarget, q3) - + this.quarterlyBonus(quarterlyTarget, q4) - + this.annualBonus(annualTarget, q1 + q2 + q3 + q4); - } - - private double quarterlyBonus(double target, double actual) { - return (actual >= target) ? actual * this.quarterlyRate : 0.0; - } - - private double annualBonus(double target, double actual) { - if (actual < target) return 0.0; - - return (actual * this.annualRate) + ((actual - target) * 0.25); - } -} diff --git a/src/section-2/BonusOnSavingsTest.java b/src/section-2/BonusOnSavingsTest.java deleted file mode 100644 index e19d447..0000000 --- a/src/section-2/BonusOnSavingsTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package ca.mokhan.assignment1; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -public class BonusOnSavingsTest extends TestCase { - private BonusOnSavings subject; - - public BonusOnSavingsTest(String testName) { - super(testName); - this.subject = new BonusOnSavings(); - } - - public static Test suite() { - return new TestSuite(BonusOnSavingsTest.class); - } - - public void testComputeBonusEmployeeOne() { - assertEquals(1650.00, subject.computeBonus(2000, 5000, 7000, 4000, 8000)); - } - - public void testComputeBonusEmployeeTwo() { - assertEquals(4680.00, subject.computeBonus(3000, 6000, 9000, 10000, 17000)); - } -} |
