Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a Java file called Write a method called computeBalance() that computes the balance of a bank account with a given initial deposit, annual interest
Create a Java file called Write a method called computeBalance() that computes the balance of a bank account with a given initial deposit, annual interest rate, after a given number of years for the investment. Assume interest is compounded yearly. The formula for determining compound interest (compounded yearly) is: A = P(1+r)! where: A = the future value of the investment/loan, including interest P = the principal investment amount (the initial deposit or loan amount) r = the annual interest rate (decimal) t = the time the money is invested or borrowed for Create your method to accept three parameters in this order: initial deposit, annual interest rate as a decimal, after a given number of years. Your method should return a double value of the future value including interest. In your main method, run the following tests to verify your method is working correctly. System.out.printf("Your total is $3.2f", computeBalance (5000, .05, 10)); // should return $8144.47 System.out.printf(" your total is $8.2E", computeBalance (2000, .03, 5)); // should return $2318.55 System.out.printf(" your total is $8.2E", computeBalance (3000, .01, 10))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started