Write an application that calculates the amount of money earned on an investment.
Prompt the user to enter an investment amount, the number of years for the investment, and the interest rate.
Display an error message if the user enters 0 for any of these values; otherwise, display the total amount (balance) for each year of the investment.
Save the file as Investment.java.
Java Program
Specific instructions:
Your output must resemble the sample below. Notice the formatting of the dollar amounts. You need to display 2 decimal places for all amounts, even for those with whole dollar amounts.
Enter investment amount: 100
Enter number of years: 10
Enter interest rate <as a decimal>: 0.5
Your Investment at 5..0% is:
After year 1 $105.00
After year 2 $110.25
After year 3 $115.76
After year 4 $121.55
After year 5 $127.63
After year 6 $134.01
After year 7 $140.71
After year 8 $147.75
After year 9 $155.13
After year 10 $162.89
Main.java:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
float
amount=Main.investAmount();
int year=Main.years();
float rate=Main.rate();
Main.calculations(amount,year,rate);
}
public static float investAmount(){
System.out.println("Enter investment Amount:");
Scanner sc = new Scanner(System.in);
float invest=sc.nextFloat();
return invest;
}
public static int years(){
System.out.println("Enter no of years:");
Scanner sc = new Scanner(System.in);
int years=sc.nextInt();
return years;
}
public static float rate(){
System.out.println("Enter interest rate(in
decimal):");
Scanner sc = new Scanner(System.in);
float rate=sc.nextFloat();
return rate;
}
public static void calculations(float inv, int year,
float rate){
int i;
for (i=1;i<=year;i++)
{
inv=inv+(inv*rate);
System.out.printf("After Year "+i+" is :
%.2f\n",inv);
}
}
}
Indentation for clear understanding:

Output:

Write an application that calculates the amount of money earned on an investment. Prompt the user...
Write a program that calculates the amount of money that you must invest In a savings account at a given interest rate for a given number of years to have a certain dollar amount at me end of the period Y our program will ask the user for the amount the user wants to have at the end of the term (future value). the number of years the user plans to let the money stay in the account, and the...
Write a program in Python that computes the interest accrued on an account. You can modify the “futval.py” program given in Chapter 2 to accomplish it. Your program should use a counted loop rather than a formula. It should prompt the user to enter the principal amount, the yearly interest rate as a decimal number, the number of compounding periods in a year, and the duration. It should display the principal value at the end of the duration. To compute...
Programming language: PYTHON Prompt: You will be creating a program to show final investment amounts from a principal using simple or compound interest. First, get a principal amount from the user. Next, ask the user if simple or compound interest should be used. If the user types in anything other than these options, ask again until a correct option is chosen. Ask the user to type in the interest rate as a percentage from 0 to 100%. Finally, ask the...
1. Prompt the user for one of the arithmetic operators ('op'): +, -, *,/, or ** 2. Prompt the user for two input integers ('a' and'b') 3. The input numbers can be positive or negative 4. Perform the arithmetic operation using the two input numbers 5. The first entered number ('a') is the left side, the second ('b') the right side of the operation For exponentiation, the first number is the base, the second the exponent Print (display) the following...
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...
Write a program that will compute the user annual salary. Prompt the user the enter (1) the weekly salary. Store the information in a double variable. Prompt the user to enter the number of weeks worked in a year. Use an int variable for that. Write code that will compute the user's Annual salary. Gross salary is salary before any deductions are taken. Update the code and prompt the user to enter the federal tax rate and the state's tax...
Write a program that prints the accumulated value of an initial investment invested at a specified annual interest and compounded annually for a specified number of years. Annual compounding means that the entire annual interest is added at the end of a year to the invested amount. The new accumulated amount then earns interest, and so forth. If the accumulated amount at the start of a year is acc_amount, then at the end of one year the accumulated amount is:...
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...
Using Javascript! Write a program 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, and then show the total pay at the end of the period. The output should be...
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...