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
dedylja [7]
4 years ago
10

Write a program that takes two numbers from the Java console representing, respectively, an investment and an interest rate (you

will expect the user to enter a number such as .065 for the interest rate, representing a 6.5% interest rate). Your program should calculate and output (in $ notation) the future value of the investment in 5, 10, and 20 years using the following formula:
future value = investment * (1 + interest rate)^year

We will assume that the interest rate is an annual rate and is compounded annually.
Computers and Technology
1 answer:
schepotkina [342]4 years ago
7 0

Answer:

in this case you have to use a For cycle

Explanation:

This is the entire code for this program

Step 1: We declare two variables investment and interest with double, and we take the numbers with the console.

We ask with console the two numbers  

We show the two number in console

Step 2: We create two new double variable: Value and cont5

We save the formula in the variable Value

We create 3 For cycle

the first one for 5 years

the second one for 10 years

the third one for 20 years

package javaapplication6;

import java.util.*;

public class JavaApplication6 {

   /**

    * @param args the command line arguments

    */

   public static void main(String[] args) {

       // TODO code application logic here

     double investment;

     double interest;

Scanner keyboard = new Scanner(System.in);

 

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

investment = keyboard.nextDouble();

System.out.println("Enter the interest" );

interest = keyboard.nextDouble();

 

System.out.println("With an investment of $"+investment);

 

System.out.println("an interest rate of "+interest+"% compounded annually:");

double Value = investment * (1+interest);

double cont5 = Value;

//int Value = getValue(investment,interest,5);

for(int year = 1; year <= 4; year++){

   cont5 = cont5 * Value;

}

System.out.println("In 5 years the value is : "+"$"+cont5);

double cont10 = Value;

//Value = getValue(investment,interest,10);

for(int year = 1; year <= 9; year++){

   cont10 = cont10 * Value;

}

System.out.println("In 10 years the value is : "+"$"+cont10);

double cont20 = Value;

//Value = getValue(investment,interest,20);

for(int year = 1; year <= 19; year++){

   cont20 = cont20 * Value;

}

System.out.println("In 20 years the value is : "+"$"+cont20);

}

}  

You might be interested in
A technology _____ begins with the birth of a new technology and ends when that technology reaches its limits and dies as it is
Aleks04 [339]
A technology cycle begins with the birth of a new technology and ends when that technology reaches its limits and dies as it is replaced by a newer, substantially better technology.
5 0
4 years ago
The receptionist’s directly connected laser printer is printing blank sheets. The technician assigned to the trouble ticket has
Studentka2010 [4]

Answer:

Correct option is B: Print a test print from the printer's console

Explanation:

At first thought, a laser print that is printing blank pages would mean that the toner is exhausted and needs to be replaced. However, if after replacing the toner, and the problem of printing blank page continues, the first troubleshoot  step to take is to be sure that the fault is not from the side of the receptionist by printing a test print from the console of the printer.

4 0
4 years ago
You can't cite Wikipedia, what are three ways that you can use it for your research?
Vlada [557]

Answer:

Scan over the article for references/resources, find general information about your topic, find keywords and terms you can use for further searching.

Explanation:

8 0
3 years ago
What are the benefits if you pay off all your high-interest debt such as credit
lesya [120]
D. All of the above
7 0
4 years ago
Read 2 more answers
You can replace a formula with its function so it remains constant. true or false.
kumpel [21]
True/Function. You can replace a formula with its function so it remains constant.
4 0
3 years ago
Other questions:
  • In a transaction-processing system (tps), if the tps database can be queried and updated while the transaction is taking place,
    11·1 answer
  • LITERALLY PLS ANYONE!!! 90 pointsss!
    7·2 answers
  • Is techonalygy harmful or useful
    6·2 answers
  • Which method of traversing a tree would result in a sorted list for a binary search tree?
    11·1 answer
  • Which phrase refers to the collection of geospatial data through the use of satellite images/pictures?
    13·1 answer
  • Input a number and find the square root only if the number entered is greater than or equal to zero.
    6·1 answer
  • A studio camera is generally small and lightweight enough to be taken out into the
    11·1 answer
  • A company has employees who write down passwords, which should be kept private, on sticky notes. Given this scenario, what shoul
    12·1 answer
  • UCLA Extension's marketing department wants
    12·1 answer
  • // This pseudocode is intended to describe
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!