LiFiUnit4Ch13,LiFiUnit4Ch13Inevstor
The files must be called <LiFiUnit4Ch13.java> The files must be called <LiFiUnit4Ch13Inevstor.java> (LiFi = Last Initial First Initial)
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.
Only submit the .java files needed to make the program run. Do not submit the .class files or any other files.
5%
Style Components
Include properly formatted prologue, comments, indenting, and other style elements as shown in Chapter 2 starting page 64 and Appendix 5 page 881-892.
5%
Topics covered in chapter
Topics with * are covered in this assignment. Ensure you use every item listed below in your completed assignment.
*Composition and Aggregation
*Inheritance
*Constructors in a Subclass
Method Overriding
*Final Access Modifier
Basic Requirements
Write a program that tracks an investment for 1 person based on the input of an interest rate. The initial balance should be $2,000. The interest should be added to the balance and output in table format as shown in the supplied sample. Balance should keep increasing until goal is met. See sample for output sample.
LiFiUnit4Ch13.java
o Instantiate an investor1 object using a two parameter constructor passing the account number 1001 and the initial balance of $2,000
o Get input for interest rate (in the format .08 for 8%)
Use class variable to set interest rate
o Get input for desired goal
45%
o Output header as per sample showing interest rate
o Print the table using a for loop displaying the current month and calling:
addInterest() to add the monthly interest for each iteration
getBalance() to display the current balance (See sample)
Only output the first 12 months and the last 3 (See sample)
See hint below on way to possibly do this
o Print “Desired Goal met on month: ### with a balance of: $####.##
Hint:
I would recommend creating an instance variable and accessor method to track the current interest being earned so it can be used in loop to output last 2 months totals.
Sample output is provided below. Be sure to mimic it exactly except for values will change based on the interest rate entered.
LiFiUnit4Ch13Investor.java
o Declare a class variable called interestRate (This will hold the annual interest rate)
o Declare a constant called ACCOUNT_NUMBER
o Declare an instance variable called balance
o Provide a class method that will be used to set the annual interest rate
o Provide a two parameter constructor to initialize the constant account number and balance
o Provide an addInterest() method to update the balance based on the interestRate entered in the driver
Add the interest using (balance * interestRate / 12)
45%
NOTE: Complete your activity and submit it by clicking “Submit Assignment”
Total Percentage
100%
Sample Your output will vary based on interest rate and goal entered. Notice how only the first 12 months and last 2 are printed
10 years ago
Purchase the answer to view it

- lifiunit4ch13.zip
- lifiunit4ch13inevstor.zip