import java.util.*;
public class Value{
static int getYears(){
Scanner sc = new
Scanner(System.in);
System.out.print("Number
of Years: ");
int years =
sc.nextInt();
sc.close();
if (years>=0)
return years;
else
return 0;
}
static double getAnnualIntRate(){
Scanner sc = new
Scanner(System.in);
System.out.print("Annual
Interest Rate: ");
double rate =
sc.nextDouble();
sc.close();
if (rate>=0)
return rate;
else
return 0;
}
static double getFutureValue(){
Scanner sc = new
Scanner(System.in);
System.out.print("Future
Value: ");
double futureValue =
sc.nextDouble();
sc.close();
if
(futureValue>=0)
return futureValue;
else
return 0;
}
static double calcPresentValue(double
futureValue, double rate, int years){
return
futureValue/Math.pow(1.0+rate/100.0, years);
}
public static void main(String[] args)
{
double futureValue =
getFutureValue();
double rate =
getAnnualIntRate();
int years =
getYears();
System.out.println("You
need to deposit " + calcPresentValue(futureValue, rate,
years));
}
}
Write a program that calculates the amount of money that you must invest In a savings...
Suppose you want to deposit a certain amount of money into a savings account and then leave it alone to draw interest for the next 10 years. At the end of 10 years you would like to have $10,000 in the account. How much do you need to deposit today make that happen? You can use the following formula, which is known as the present value formula, to find out: P = F / (1+ r)^n The terms in...
I need help with this code: 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 Use text fields for interest rate, investment amount, and years. Display the future amount in a text field when the user clicks the Calculate button, as shown in the following figure. It needs to be done in...
P5.3 Present Value. Suppose you want to deposit a certain amount of money into a savings account and then leave it alone to draw interest for the next 10 years. At the end of 10 years you would like to have $10,000 in the account. How much do you need to deposit today tomake that happen? You can use the following formula, which is known as the present value formula, to find out: P = F/(1+r)^n The terms in the...
Please help me do this program. Add some comments on it. *15.5 (Create an investment-value calculator) Write a program that calculates the future value of an investment at a for the calculation is given interest rate for a specified number of years. The formula investmentAmount * (1monthlyInterestRate ) years *12 futureValue Use text fields for the investment amount, number of years, and annual interest rate. Display the future amount in a text field when the user clicks the Calculate button,...
Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate the amount that you will have after a specific number of months. The formula is as follows: f = p * (1 + i)^t • f is the future value of the account after the specified time period. • p is the present value of the account. • i is the monthly interest rate. • t is the...
LULUPULUS! WORK AREA Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate the amount that you will have after a specific number of months. The formula is as follows: f=p* (1 + i)^t • fis the future value of the account after the specified time period. •p is the present value of the account. i is the monthly interest rate. .t is the number of months How...
C++ 18. Savings Account Balance Write a program that calculates the balance of a savings account at the end of a three month period. It should ask the user for the starting balance and the annual interest rate. A loop should then iterate once for every month in the period, performing the following A) Ask the user for the total amount deposited into the account during that month. Do not accept negative numbers. This amount should be added to the...
a. Create the logic for a program that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest for one year. Create a separate method to do the calculation and return the result to be displayed. b. Modify the program in Exercise 3a so that the main program prompts the user for the amount of money and passes it to the interest-calculating method. c. Modify the program in Exercise 3b so...
The principal represents an amount of money deposited in a savings account subject to compound interest at the given rate. Find how much money will be in the account after the given number of years (Assume 360 days in a year.), and how much interest was earned. Int A P A = Pert n nt 1 + 38) Principal: $10,000 Rate: 5% Compounded: semiannually Time: 5 years A) amount in account: $11,314.08; interest earned: $1314.08 B) amount in account: $12,762.82;...
Write a program using Python that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing what the salary was for each day, then show the total pay at the end of the period. The output should be displayed...