The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
The file must be called (driver program)
FiLiSavingsAccount.java (handles interest and balance calculations)
(FiLi = First Initial Last Initial)
Example: KenDeweyChapter13.java (driver program)
KDSavingsAccount.java
Ensure you include ALL files required to make your program compile and run.
I would like to see your .java files only.
Proper coding conventions required the first letter of the class start with a capital
letter and the first letter of each additional word start with a capital letter.
Overall Requirements
Write a program that establishes two savings accounts with saver1 having account
number 10002 with an initial balance of $2,000, and saver2 having account 10003
with an initial balance of $3,000. Set a common rate of interest at 5% per year. At the
end of each month, update the balance by adding one monthA????1s interest to the
balance, so that the balance compounds monthly. Print an output that displays the
month number and the account number and the balance for each of the two
accounts. Use month 0 to display the initial balances, month 1 to display the
balances after the first monthA????1s interest, and so on. At the end of the year, display the
total balance for both accounts combined, like this:
Output:
Monthly balances for one year with 0.05 annual interest:
Month Account #        Balance           Account #        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
Final balance of both accounts combined: 5255.81
Use two classes, a FiLiSavingsAccount class and a YourNameChapter13 as your
Driver class.
FiLiSavingsAccount.java class
In the SavingsAccount class, declare a class variable called annualInterestRate,
an instance constant called ACCOUNT_NUMBER, and an instance variable called
balance. Provide a two-parameter constructor to initialize the instance constant and
instance variable, and provide accessors for the instance constant and instance
variable. Provide an addMonthlyInterest method to update the balance, by adding
(balance * annualInterestRate / 12) to the current balance.
You are also required to provide a class method that sets the annual interest rate.
YourNameChapter13.java class
In the YourNameChapter13 Driver class, instantiate the saver1 and saver2 objects.
Set the annual interest rate at 0.05. Print the table heading lines. Use a for loop to
print the initial account numbers and balances and the account numbers and
balances each month after that monthA????1s interest has been added. After the last
monthA????1s printout, compute and display the total of both balances.
Your driver should generate the following outputs:
Output:
Monthly balances for one year with 0.05 annual interest:
Month Account #        Balance           Account #        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
Final balance of both accounts combined: 5255.81
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll