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
Human-centered technology often recommends _______ao
lidiya [134]

Answer:

Creating objects which people are going to interact with, designers have to be aware of those traits and take them into account in the process. ... Continuing the theme, user-centered design is more focused and concise version of human-centered design with deeper analysis of target audience.The user interacts directly with hardware for the human input and output such as displays, e.g. through a graphical user interface. The user interacts with the computer over this software interface using the given input and output (I/O) hardware.Human-centered design is a creative approach to problem solving and the backbone of our work at IDEO.org. It's a process that starts with the people you're designing for and ends with new solutions that are tailor made to suit their needs. ... Human-centered design consists of three phases.

Explanation:

3 0
3 years ago
Read 2 more answers
What special member function of a class is called whenever an instance of a class is created and initialized?
allochka39001 [22]
It's called a constructor function, but it's name is the same as the class' name.
6 0
3 years ago
In the RGB model, which color is formed by combining the constituent colors?
iogann1982 [59]
If you combine maximum values of Red Green and Blue you will get white.
4 0
3 years ago
Read 2 more answers
Suponiendo que el centro de la gravedad de la barra se enchentra a 3 m del punto de apoyo,y su contrapeso, de 4800 N, se encuent
VikaD [51]

Answer:

C

Explanation:

because...

6 0
3 years ago
You must have an active ____ to test external links.
charle [14.2K]
Network & internet connection
4 0
4 years ago
Other questions:
  • Coretta is thinking about which careers she would enjoy. She considers her personal skills and interests. She enjoys reading and
    13·2 answers
  • Think about your favorite technology item - phone, game, smartTV, etc. - Write about how your favorite technology item has impac
    7·1 answer
  • Which tool is used to create an interactive web application?
    15·1 answer
  • Which internet site end in .com​
    10·2 answers
  • OSHA requires training for employees on the hazards to which they will be exposed.
    12·2 answers
  • "Create a Python program named detect_column_level_data_entry_errors. When complete, you will run this program to produce a diag
    11·1 answer
  • What acronym describes networked devices that contain microcomputers but are not thought of as computing devices, such as refrig
    9·1 answer
  • All the following are the basis of the World Wide Web except:
    14·2 answers
  • Question #2
    7·1 answer
  • What does it mean when we say that Unity “handles terrain natively,” and how can that assist in game development?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!