From dd5b4a7bf153db36835ddd7cfffeae27fd83c190 Mon Sep 17 00:00:00 2001 From: josh Date: Sat, 3 Oct 2009 18:24:47 +0000 Subject: [PATCH] filling out more Model functions git-svn-id: svn://anubis/gvsu@434 45c1a28c-8058-47b2-ae61-ca45b979098e --- cs623/proj1/RetirementCalculator.java | 4 ++-- cs623/proj1/RetirementCalculatorModel.java | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cs623/proj1/RetirementCalculator.java b/cs623/proj1/RetirementCalculator.java index c1dc94e..02a8cfe 100644 --- a/cs623/proj1/RetirementCalculator.java +++ b/cs623/proj1/RetirementCalculator.java @@ -16,8 +16,8 @@ class RetirementCalculatorPanel extends JPanel implements ActionListener public RetirementCalculatorPanel() { JPanel inner = new JPanel(new GridLayout(3, 2)); - JButton b = new JButton("HI"); - inner.add(b); + inner.add(new JLabel("How much annual income will you want in retirement?")); + inner.add(new JTextField()); JScrollPane scrollpane = new JScrollPane(inner, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); diff --git a/cs623/proj1/RetirementCalculatorModel.java b/cs623/proj1/RetirementCalculatorModel.java index 6e45bfd..66e2336 100644 --- a/cs623/proj1/RetirementCalculatorModel.java +++ b/cs623/proj1/RetirementCalculatorModel.java @@ -34,12 +34,7 @@ public class RetirementCalculatorModel public void calculate() { - if (myCurrentIncome < 25000.0) - mySocialSecurity = 8000.0; - else if (myCurrentIncome <= 40000.0) - mySocialSecurity = 12000.0; - else - mySocialSecurity = 14500.0; + mySocialSecurity = calculateSocialSecurity(); } private double calculateRetirementFactor() @@ -49,7 +44,12 @@ public class RetirementCalculatorModel private double calculateSocialSecurity() { - return 0.0; + if (myCurrentIncome < 25000.0) + return 8000.0; + else if (myCurrentIncome <= 40000.0) + return 12000.0; + else + return 14500.0; } private double calculateSavingsFactor()