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]
3 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]3 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
During which part of geologic time were dinosaurs most common?
ANTONII [103]
The answer is C. Jurassic.
6 0
3 years ago
Read 2 more answers
When using bits to represent fractions of a number, can you make all possible fractions?
saw5 [17]
This is your perfect answer

8 0
2 years ago
Technician A says that volatility describes how hard it is for gasoline to evaporate. Technician B says that Reid vapor pressure
Lubov Fominskaja [6]

I’d say both techies are correct.

Volatility, as applied in gasoline, is quantified by the tendency of the liquid to change to vapor at any given temperature (vaporize). This rate of change might be hard or easy, this depends on the temperature or the pressure. Technician B is also correct. RVP is defined and determined experimentally according to the ratio of the vapor volume to the liquid volume at 100 °F.

8 0
3 years ago
What is an information​ system? A. Information databases B. Information technology C. Hardware and software components D. Comput
Tom [10]

Answer:

Option E Components that interact to produce information

Explanation:

Information system is a system to collect, analyze and disseminate information. An information system consists of five components that work with each other to produce information:

  1. Computer hardware - physical machine that works with information
  2. Computer software - a set of computer instructions that tell computer hardware how to perform a task
  3. Telecommunications - components that connect a group of hardware as to establish a network. This usually includes WiFI technology.
  4. Databases and data warehouses - the place where the digital data are kept and retrieved.
  5. Human resources and procedures - human expertise that run the system by following some standard procedures.
5 0
3 years ago
Dereck works for long hours on his computer. He frequently experiences physical strain by the end of the day because he does not
Anni [7]
I think the answers are B and D!
4 0
3 years ago
Read 2 more answers
Other questions:
  • Jeremy, a college student, is preparing to give a speech on "Social Responsibilities." He refers to a Web page on a tab using
    10·1 answer
  • How long did it take Linkedln to reach 1 million users?
    5·2 answers
  • Which area of physics governs wireless communication?
    10·2 answers
  • Ng/ Computer Applications - Office 2016 - EL3520 A
    13·1 answer
  • What should be included in the closing portion of your letter or e-mail?
    12·2 answers
  • Which of these is the largest?<br> terabyte<br> exabyte<br> gigabyte<br> kilobyte<br> PLEASE HELP
    5·1 answer
  • A program with a graphical user inter-face for displaying HTML files, used to navigate the World Wide Web.
    8·1 answer
  • 40 points for this question
    7·2 answers
  • Write a program that takes a string as an input. If the string entered is equal to
    9·1 answer
  • Computers rarely make mistakes. True or false
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!