Commit 901ff41

mokha <mokha@cisco.com>
2019-04-28 20:46:02
calculate expected results
1 parent ed2d1ef
Changed files (2)
assignments
assignment1
src
test
java
ca
mokhan
assignments/assignment1/src/test/java/ca/mokhan/assignment1/BonusOnSavingsTest.java
@@ -0,0 +1,31 @@
+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(subject.computeBonus(2000, 5000, 7000, 4000, 8000), 1650.00);
+  }
+
+  public void testComputeBonusEmployeeTwo()
+  {
+    assertEquals(subject.computeBonus(3000, 6000, 9000, 10000, 17000), 4680.00);
+  }
+}
assignments/assignment1/README.md
@@ -39,6 +39,17 @@ Q2 – $7000
 Q3 – $4000
 Q4 – $8000
 
+Quarterly minimum: $6,000
+Annual minimum: $24,000
+
+Q1: Does not meet quarterly minimum.
+Q2: Exceeds quarterly minimum. $7000 * 3% = $210
+Q3: Does not meet quarterly minimum
+Q4: Exceeds quarterly minimum. $8000 * 3% = $240.
+Y1: $24,000.00 meets the annual minimum. $24,000.00 * 5% = $1,200.00
+
+Total bonus: 210 + 240 + 1200 = $1,650.00
+
 II. Another employee has committed to save $3000 per month.
 His quarterly savings are as follows:
 
@@ -47,6 +58,21 @@ Q2 – $9000
 Q3 – $10000
 Q4 – $17000
 
+Quarterly min: $9000.00
+Annual min: $36,000.00
+
+Q1: does not meet quarterly min.
+Q2: $9,000 * 3% = $270.00
+Q3: $10,000 * 3% = $300.00
+Q4: $17,000 * 3% = $510.00
+Y1: $42,000.00 saved. $42,000.00 * 5% = $2,100.00
+
+42,000 - 36,000 = $6,000 * 25% = $1,500.00
+
+Total: $270.00 + $300.00 + $510.00 + $2,100.00 + $1,500.00
+$4,680.00
+
+
 Write a program to compute the total bonus amount earned by these two employees in the year.
 
 ```ruby