Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Modify the compound-interest application in interest.java (available on Blackboard) to repeat its steps for interest rates of 5%, 6%, 7%, 8%, 9% and 10%.

1. Modify the compound-interest application in interest.java (available on Blackboard) to repeat its steps for interest rates of 5%, 6%, 7%, 8%, 9% and 10%. Use a for loop to vary the interest rate.

interest.java :

// Compound-interest calculations with for. public class Interest { public static void main(String[] args) { double principal = 1000.0; // initial amount before interest double rate = 0.05; // interest rate // display headers System.out.printf("%s%20s%n", "Year", "Amount on deposit"); // calculate amount on deposit for each of ten years for (int year = 1; year <= 10; ++year) { // calculate new amount on deposit for specified year double amount = principal * Math.pow(1.0 + rate, year); // display the year and the amount System.out.printf("%4d%,20.2f%n", year, amount); } } }

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

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

What is an example of 'tourism branding' in action?

Answered: 1 week ago