1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
SCORPION-xisa [38]
4 years ago
14

Write a program that calculates the future value of an investment at a given interest rate for a specified number of years. The

formula for the calculation is as follows:futureValue = investmentAmount * (1 + monthlyInterestRate)years*12
Computers and Technology
1 answer:
baherus [9]4 years ago
8 0
<h2>Question:</h2>

Write a program that calculates the future value of an investment at a given interest rate for a specified number of years. The formula for the calculation is as follows:

futureValue = investmentAmount * (1 + monthlyInterestRate) ^ years * 12

Note: Allow users to enter the values of the investmentAmount, monthlyInterestRate and years from standard input.

Assume the number of years is always a whole number.

<h2>Answer:</h2>

===================================================

//import the Scanner class

import java.util.Scanner;

//Class header definition

public class FutureValue{

   

    //Main method definition

    public static void main(String []args){

       

       //Create an object of the Scanner class

       Scanner input = new Scanner(System.in);

       

       //Prompt the user to enter the investment amount

       System.out.println("Enter the investment amount");

       

       //Store the input in a double variable called investmentAmount

       double investmentAmount = input.nextDouble();

       

       //Next, prompt the user to enter the interest rate

       System.out.println("Enter the interest rate in percentage");

       

       //Store the input in a double variable called interestRate

       double interestRate = input.nextDouble();

       

       //Convert the interest rate to decimal by multiplying by 0.01

       interestRate *= 0.01;

       

       //Convert the interest rate to monthly interest rate by dividing the

       //result above by 12

       double monthlyInterestRate = interestRate / 12;

       

       //Prompt the user to enter the number of years

       System.out.println("Enter the number of years");

       

       //Store the input in an integer variable called years

       int years = input.nextInt();

       

       //Using the given formula, find the future value

      double futureValue =  investmentAmount * Math.pow(1 + monthlyInterestRate, years * 12);

       

       //Print out the future value

      System.out.println("Future value : " + futureValue);

       

    } //End of main method

     

}  // End of class definition

===================================================

<h2>Sample Output</h2>

===================================================

<em>>> Enter the investment amount </em>

1000

>> <em>Enter the interest rate in percentage </em>

10

>> <em>Enter the number of years </em>

5

Future value : 1645.3089347785854

===================================================

<h2>Explanation:</h2>

The code above has been written using Java. The code contains comments explaining every line of the code. Please go through the comments. The actual lines of code have been written in bold-face to distinguish them from comments. A sample output has also been provided as a result of a run of the code.

You might be interested in
Jackson builders is constructing new homes in the Parkway subdivision.The company needs the logic for an application that ncalls
lord [1]
<span>The calculatePrice() method can be written in C. It will use and return doubles (which allows for decimals). It will calculate the house price of $100K + $20K per bedroom and $30K per bathroom. Next it will take that price and append the sales percentage and return that value.
double calculatePrice(decimal numBedrooms, decimal numBathrooms, decimal salesPercentage)
{
decimal housePrice = 100000 + (20000 * numBedrooms) + (30000 * numBathrooms);
return housePrice + (housePrice * salesPercentage);
}</span>
8 0
4 years ago
Do u have to divide or multiply this problem 5300 yd = mi
Alona [7]

Answer:

the answers is 3.011364 and if you need to roundnit would be 3.01

6 0
3 years ago
What is a back door?
V125BC [204]

Answer:

A backdoor is a typically covert method of bypassing normal authentication or encryption in a computer, product, embedded device, or its embodiment. Backdoors are most often used for securing remote access to a computer, or obtaining access to plaintext in cryptographic systems.

Explanation:

3 0
3 years ago
Read 2 more answers
You're a volunteer at a local charity, and you've been asked to create a flyer for a fundraiser. The charity wants to send the f
amm1812

Since you aren't sure that all recipients have access to Microsoft Word, you should save the file by using the "Save as" command.

<h3>What is Microsoft Word?</h3>

Microsoft Word can be defined as a word-processing software program that is designed and developed by Microsoft Inc., so as to avail its end users an ability to type, format, adjust and save text-based documents or files.

<h3>What is a file?</h3>

A file can be defined as a computer resource or type of document that avails an end user the ability to save or record data as a single unit on a computer storage device.

In this scenario, we can infer and logically deduce that you should save the file by using the "Save as" command because you aren't sure that all recipients have access to Microsoft Word.

Read more on Microsoft Word here: brainly.com/question/25813601

#SPJ1

3 0
2 years ago
Recovery point objectives of a recovery plan specify ________.
Ksenya-84 [330]

Answer:

The correct option to the following question is an option (D).

Explanation:

Because RPO(Recovery point objective) is the objective in which we getting the greatest level of the privacy. confidence and the important thing is security for our resources.

The best thing is that the center of activity of the RPO in on the data and the overall elasticity of the loss of your company.

5 0
3 years ago
Other questions:
  • How would you determine if your earned credits would transfer to a regionally accredited school?
    14·2 answers
  • Technician A says that a cracked exhaust manifold can affect oxygen sensor operation. Technician B says that a clogged air filte
    7·1 answer
  • Path of the signal of television
    6·1 answer
  • What are the first steps in creating a business document
    6·2 answers
  • Your friend wants to purchase a new hard drive. She wants a drive that has fast access because she will use it to edit videos on
    8·1 answer
  • The basic assumption that underlines event driven modeling is that the system can be represented as a model with an infinite num
    9·1 answer
  • SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume that the classes listed in the Java Quick R
    9·1 answer
  • Which of the following is not a Nintendo game character?
    6·2 answers
  • You are the administrator for a small network with several servers. There is only one printer, which is centrally located. Altho
    10·1 answer
  • What is the purpose of the Hide Slide feature in a presentation program?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!