diff options
| author | mokha <mokha@cisco.com> | 2019-05-14 21:44:32 -0600 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2019-05-14 21:44:32 -0600 |
| commit | e6aeae0240b71b1137184005c27f8528feeb1580 (patch) | |
| tree | 026c2ea0e7474e085fbbe3e88da8953abb3ab28c /src/Q2/BonusOnSavings.java | |
| parent | d4ebaf2a4a33965526d4d56b639379200a406bef (diff) | |
add console program for Q2
Diffstat (limited to 'src/Q2/BonusOnSavings.java')
| -rw-r--r-- | src/Q2/BonusOnSavings.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Q2/BonusOnSavings.java b/src/Q2/BonusOnSavings.java index 4d80361..c306e51 100644 --- a/src/Q2/BonusOnSavings.java +++ b/src/Q2/BonusOnSavings.java @@ -8,6 +8,8 @@ */ package Q2; +import java.util.Scanner; + public class BonusOnSavings { double annualRate = 0.0; double quarterlyRate = 0.0; @@ -74,4 +76,27 @@ public class BonusOnSavings { return (actual * this.annualRate) + ((actual - target) * 0.25); } + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + System.out.print("Please enter your monthly contribution: "); + double monthlyCommitment = in.nextDouble(); + + System.out.print("Please enter Q1 contributions: "); + double q1 = in.nextDouble(); + + System.out.print("Please enter Q2 contributions: "); + double q2 = in.nextDouble(); + + System.out.print("Please enter Q3 contributions: "); + double q3 = in.nextDouble(); + + System.out.print("Please enter Q4 contributions: "); + double q4 = in.nextDouble(); + + BonusOnSavings savings = new BonusOnSavings(); + double bonus = savings.computeBonus(monthlyCommitment, q1, q2, q3, q4); + + System.out.println("The calculated bonus is " + bonus); + } } |
