Total interest earned on a financial investment

Assignment Help Basic Computer Science
Reference no: EM132298043

Using Java, compile a method named invest that computes and return the total interest earned on a financial investment. Once per year, the bank pays interest to the investor at a given fixed rate. As the investment earns interest, that interest is added to the investment and therefore the interest begins earning interest of its own ("compounding").

Your method should accept three parameters in the main function: the initial amount of the investment in dollars (as a real number such as 1500.0 for $1,500.00), the yearly interest rate (as a real number such as 3.5 for 3.5% interest) and the number of years for which to invest (as an integer such as 6 for 6 years) and then returns the total interest earned (as a real number such as 35.60 for $35.60).

Your method should print the value of the investment after each year. Upon return, your program should print cumulative interest earned over all years in the main function. For example, an investment of $100.00 at 10% interest for 5 years would lead to this call:

// $100.00 at 10% interest for 5 years

double totalInterest = invest(100.00, 10.0, 5);

The call would produce the following console output. Dollar amounts print with 2 digits after the decimal.

Notice that we are not simply adding 10% of $100.00 (or $10.00) each year; that would lead to $50 of total interest earned. The first year adds 10% of $100.00, but the second year adds 10% of $110.00, or $11.00, leading to a total of $121.00. The third year adds 10% of $121.00, or $12.10, leading to a total of $133.10 and so on. The interest is cumulative. You may assume that all parameter values passed are non-n

Reference no: EM132298043

Questions Cloud

Understand different types of authentication : Understand different types of authentication and potential use of combination of more than one type?
Some databases sort the query results : Some databases sort the query results in ascending order by default... which RDBMS behave this way?
Show that the exclusive-or of two regular languages : Given two languages, L and M, define the exclusive-or of L and M as the set of all strings, w, such that w is in L and not in M or w is in M and not in L.
Spreadsheets as data storage and data analysis tools : What is a spreadsheet. How do we use spreadsheets as data storage and data analysis tools? How do you use spreadsheets to manage daily administrative tasks
Total interest earned on a financial investment : Using Java, compile a method named invest that computes and return the total interest earned on a financial investment.
Analyze the capabilities of the software : EPM5700 - Project Management and Information Technology - Victoria University - Analyze the capabilities of the software and particularly the ability
Describe the concept of polymorphism : Describe the concept of polymorphism. Provide an example to illustrate your point. The example may be pseudocode
Significance of declaring a reference parameter : What is the significance of declaring a reference parameter or a pointer parameter as a const parameter?
Process crucial for any organization to have and follow : Why is an update/patch process crucial for any organization to have and follow?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Problem on the prime factorization

Prime Factorization. Take your solutions for is prime() and get factors() in the previous problems and create a function that takes an integer as input.

  Determine the cardinality for region

Construct a Venn diagram and determine the cardinality for each region. Use the completed Venn Diagram to answer the following questions.

  Object oriented and task oriented programming

What is the difference between Object Oriented and Task Oriented Programming?

  Can a system provide integrity without confidentiality

A noted computer security expert has said that without integrity, no system can provide confidentiality.

  Provide several examples of how digital platforms

Provide several examples of how digital platforms are being used to improve business processes and build solutions in the fields of energy

  Indicate the personnel resources needed for investigation

Indicate the personnel resources needed for the investigation and assess why you believe this amount of resources is warranted.

  Explain the benefits of an incident response plan

Explain the benefits of an incident response plan. Identify and explain with reasonable details the steps to isolate, respond, and recover after an attack (incident) is discovered.

  Company should discontinue operations

Determine the possible circumstances under which the company should discontinue operations. Suggest key actions that management should

  How would you describe graph

1) Is this a function? 2) What is its domain? 3) What is its range? 4) What is its y-intercept, if any?

  How would you use sql to change a table''s structure

How would you use SQL to change a table's structure? What general types of changes are possible? Which commands are used to implement these changes?

  Dbms products to consider for a project

Research: List at least 4 DBMS products to consider for a project Analyze the four products and compare to each other(strengths and weaknesses)

  Need for designing procedures for simple tasks

What are the need for designing procedures for simple tasks such as creating or modifying access controls?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd