Electronic handin will be available after 5PM on Thursday.
TC Bank has hired you to create a program to compute the final value of a certificate of deposit for a customer. In this account, the customer deposits some initial amount (D) and then leaves the money in the account for exactly one year. During this year, the account earns an annual rate of compounded interest of I. The number of times per year that the account earns interest is given by n. The final amount in the certificate of deposit at the end of the year based on the information above is given by the formula:
For example, customer Andrew Carnegie opens a certificate of deposit with $15110.00 for exactly one year with an interest rate of 6% "compounded monthly". The phrase "compounded monthly" means that interest is earned every month, or 12 times per year. This means that D = 15110.00, I = 0.06 and N = 12. Based on the formula above, Carnegie would have an account with approximately $16041.95 at the end of one year.
Write a simple Java program in a project named Program1 that contains one class named InterestCalculator that computes and displays the final amount in a certificate of deposit for one year given the initial deposit, annual interest rate and number of interest payments per year.
Your InterestCalculator class must have two methods as described below.
************************************** TC BANK - CERTIFICATE OF DEPOSIT **************************************
NOTE: If the monetary value ends in 0 cents (e.g. $15110.00), this can be output without the extra 0, ($15110.0 is ok).
Your output should be displayed as shown in the following examples, using your displayBanner method to print the banner. Depending on how you do your calculation, your results may differ slightly from the result shown below. Look at the samples to determine the appropriate types for each variable you need.
Here are 4 separate runs of the program (user input shown in italics):
Please input the initial deposit: 15110.00 Please input the interest rate as a percentage: 6.0 Please input the number of interest payments per year: 12 ************************************** TC BANK - CERTIFICATE OF DEPOSIT ************************************** Initial Deposit: $15110.0 Interest Rate: 6.0% Number of Interest Payments: 12 Final Amount: $16041.95 Please input the initial deposit: 4321.00 Please input the interest rate as a percentage: 5.5 Please input the number of interest payments per year: 365 ************************************** TC BANK - CERTIFICATE OF DEPOSIT ************************************** Initial Deposit: $4321.0 Interest Rate: 5.5% Number of Interest Payments: 365 Final Amount: $4565.29 Please input the initial deposit: 123.45 Please input the interest rate as a percentage: 7.0 Please input the number of interest payments per year: 4 ************************************** TC BANK - CERTIFICATE OF DEPOSIT ************************************** Initial Deposit: $123.45 Interest Rate: 7.0% Number of Interest Payments: 4 Final Amount: $132.32 Please input the initial deposit: 10000.00 Please input the interest rate as a percentage: 12.0 Please input the number of interest payments per year: 1 ************************************** TC BANK - CERTIFICATE OF DEPOSIT ************************************** Initial Deposit: $10000.0 Interest Rate: 12.0% Number of Interest Payments: 1 Final Amount: $11200.0
Compile and test that your program runs correctly. If your program does not compile and run, you will not receive full credit for your assignment.
What happens if your program asks for a double value and you input an integer? What happens if your programs asks for an int value and you input a floating point value? Add a comment to your program to explains what happens and why this makes sense.
Make sure you add a comment at the beginning of your program with your name, andrew id, and section.
See the course website for instructions on how to hand in your program. Remember that the work you submit must be your own. Also, late hand-ins are not accepted. Please plan ahead and submit early to avoid server overload at the deadline. The deadline is based on the server's clock, not your clock. Please do not email your code to your instructor or course assistant as your official hand-in; these will not be graded.