Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Write a method called computeBalance( ) that computes the balance of a bank account with a given initial balance and interest rate, after a

JAVA

Write a method called computeBalance( ) that computes the balance of a bank account with a given initial balance and interest rate, after a given number of years. Assume interest is compounded yearly.

You can use the standard calculator here to check your results (note that you'll have to change the dropdown to compound the interest yearly): http://www.thecalculatorsite.com/finance/calculators/compoundinterestcalculator.php

Use a loop to control the iterations through the years in your method.

Your method should return a double value.

In your main method, run the following tests to verify your method is working correctly.

System.out.printf("Your total is $%.2f", computeBalance(1000, .045, 3));

// should return $1141.17

System.out.printf(" Your total is $%.2f", computeBalance(2000, .03, 5));

// should return $2318.55

System.out.printf(" Your total is $%.2f", computeBalance(3000, .01, 10));

// should return $3313.87

Pay close attention to your parameters to make sure they match the test datat!

*Note: Your methods should have this exact signature line, including the correct spelling, capitalization and parameter types. Otherwise, when I run the test to check the file, your methods will fail and you'll have to revise.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Auditors appoint directors. True/False?

Answered: 1 week ago