Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java 5.18 Modified Compound Interest Program- Modify the application in Fig 5.6 to use only integers to calculate the compound interest.[Hint: Treat all monetary amounts

Java 5.18 Modified Compound Interest Program- Modify the application in Fig 5.6 to use only integers to calculate the compound interest.[Hint: Treat all monetary amounts as integral numbers of pennies. Then break the result into its dollar and cents portions by using the division and remainder operations, respectively. Insert a period between the dollar and cents portion.] Ex. output $100.26

Fig 5.6

public class Modified_Compound_Interest_Program {

public static void main(String[] args) {

double amount; //amount on deposit at end of each year 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) { //calcualte new amount for specified year amount = principal * Math.pow(1.0 + rate, year);

//display the year and the amount System.out.printf("%4d%,20.2f%n", year, amount); } } } // end of class

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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

Students also viewed these Databases questions

Question

Which of the following is NOT a relational operator? 1. =

Answered: 1 week ago

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago