Prog._Assignment — Week 4

ProgramChapter13

GradingInformation:ThisProgramisdueonSundayatMidnight.Comments
areREQUIRED;flowcharts
andpseudocodeareNOTREQUIRED.

Directions

Points

Thefile
mustbecalled
<YourNameChapter13.java>(driverprogram)FiLiSavingsAccount.java(handlesinterestandbalancecalculations) (FiLi=FirstInitialLastInitial)

Example:KenDeweyChapter13.java(driverprogram)

KDSavingsAccount.java

Ensureyouinclude ALL
filesrequiredtomakeyour
program compileandrun.Iwouldlike
toseeyour
.javafilesonly.

Propercoding
conventionsrequiredthefirstletter
oftheclass
startwithacapital
letterandthefirstletter
ofeachadditionalwordstartwithacapital
letter
.

5%

OverallRequirements

Writeaprogram
thatestablishestwosavingsaccountswithsaver1havingaccount
number10002with
aninitialbalanceof$2,000,and
saver2
havingaccount10003 withaninitialbalance
of$3,000.Setacommon
rateofinterestat5%peryear.Atthe
endofeachmonth,update
thebalanceby addingonemonth’sinteresttothe balance,sothatthebalancecompoundsmonthly.Printanoutputthatdisplaysthemonthnumberandtheaccountnumberandthebalanceforeachofthetwo accounts.Usemonth0todisplay
theinitialbalances,month1todisplaythe balancesafterthefirst
month’sinterest,andsoon.Attheendoftheyear,
displaythe totalbalanceforbothaccountscombined,likethis:

Output:

Monthlybalancesforoneyear
with0.05annual
interest:MonthAccount# BalanceAccount
# Balance

————– —————- ——-

0 10002 2000.00 10003 3000.00

1 10002 2008.33 10003 3012.50

2 10002 2016.70 10003 3025.05

3 10002 2025.10 10003 3037.66

4 10002 2033.54 10003 3050.31

5 10002 2042.02 10003 3063.02

6 10002 2050.52 10003 3075.79

7 10002 2059.07 10003 3088.60

8 10002 2067.65 10003 3101.47

10%

9 10002 2076.26 10003 3114.39

10 10002 2084.91 10003 3127.37

11 10002 2093.60 10003 3140.40

12 10002 2102.32 10003 3153.49

Finalbalanceofbothaccountscombined:5255.81

Usetwoclasses,aFiLiSavingsAccountclassandaYourNameChapter13asyour
Driverclass.

FiLiSavingsAccount.javaclass

IntheSavingsAccountclass,declare
aclassvariablecalledannualInterestRate,aninstanceconstantcalledACCOUNT_NUMBER,andaninstancevariablecalledbalance.Provideatwo-parameterconstructortoinitializetheinstanceconstantandinstancevariable,andprovideaccessorsfortheinstanceconstantandinstancevariable.ProvideanaddMonthlyInterestmethodtoupdatethebalance,byadding
(balance*annualInterestRate/12)tothecurrentbalance.

Youarealsorequiredtoprovideaclassmethod
thatsetstheannualinterestrate.

40%

YourNameChapter13.javaclass

IntheYourNameChapter13Driver
class,instantiatethe
saver1
andsaver2objects.Settheannual
interestrateat0.05.Printthetableheading
lines.Useaforlooptoprinttheinitialaccountnumbersandbalancesand
theaccountnumbersand balanceseachmonth
afterthatmonth’s
interesthasbeenadded.After
thelast month’s
printout,computeanddisplaythetotalofbothbalances.

40%

Yourdrivershouldgeneratethefollowingoutputs:

5%

Output:

Monthlybalancesforoneyear
with0.05annual
interest:

MonthAccount# BalanceAccount
# Balance

————– —————- ——-

0 10002 2000.00 10003 3000.00

1 10002 2008.33 10003 3012.50

2 10002 2016.70 10003 3025.05

3 10002 2025.10 10003 3037.66

4 10002 2033.54 10003 3050.31

5 10002 2042.02 10003 3063.02

6 10002 2050.52 10003 3075.79

7 10002 2059.07 10003 3088.60

8 10002 2067.65 10003 3101.47

9 10002 2076.26 10003 3114.39

10 10002 2084.91 10003 3127.37

11 10002 2093.60 10003 3140.40

12 10002 2102.32 10003 3153.49

Finalbalanceofbothaccountscombined:5255.81

Uploadyourpage
totheDropbox.

NOTE:Completeyouractivityandsubmitittothe
DropboxineCollege

TotalPoints

100%