Skip to content
Snippets Groups Projects
Commit adb988f3 authored by Goik Martin's avatar Goik Martin
Browse files

Account solution eclipse project zip file

parent 248e976b
No related branches found
No related tags found
No related merge requests found
......@@ -1941,7 +1941,41 @@ public void writeSvg() {
<para>We need the appropriate getter and setter methods:</para>
<programlisting/>
<programlisting> /**
* @return
* the current default interest rate value.
*/
public static double getDefaultInterestRate() {
return defaultInterestRate;
}
/**
* This interest rate will be applied to negative balances. In contrast
* {{@link #setInterestRate(double)} will handle positive balance values.
*
* @param defaultInterestRate
* the desired default interest rate value.
*/
public static void setDefaultInterestRate(double defaultInterestRate) {
Account.defaultInterestRate = defaultInterestRate;
}</programlisting>
<para>The computed interest depends on positive or negative
balance values:</para>
<programlisting> public void applyInterest(int years) {
if (0 &lt; balance) {
balance = balance * Math.pow((1 + interestRate / 100), years) ;
} else if (balance &lt; 0){
balance = balance * Math.pow((1 + defaultInterestRate / 100), years) ;
}
}</programlisting>
<para>A complete solution including updated
<productname>Javadoc</productname> comments can be downloaded
<link
xlink:href="https://cloud.mi.hdm-stuttgart.de/owncloud/public.php?service=files&amp;t=577bc9091391524692b6d812a6d2737a">from
here</link>.</para>
</answer>
</qandaentry>
</qandadiv>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment