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 java fx.
Thank you in advance!!
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
public class FutureValue extends Application {
TextField investment, rate, years, futureValue;
@Override
public void start(Stage myStage) {
myStage.setTitle("Future Value");
GridPane rootNode = new GridPane();
rootNode.setPadding(new Insets(25));
rootNode.setHgap(10);
rootNode.setVgap(10);
rootNode.setAlignment(Pos.CENTER);
Scene myScene = new Scene(rootNode, 500, 500);
rootNode.add(new Label("Investment Amount"), 0, 0);
investment = new TextField();
rootNode.add(investment, 1, 0);
rootNode.add(new Label("Annual Interest Rate"), 0, 1);
rate = new TextField();
rootNode.add(rate, 1, 1);
rootNode.add(new Label("Number of years"), 0, 3);
years = new TextField();
rootNode.add(years, 1, 3);
futureValue = new TextField();
futureValue.setEditable(false);
rootNode.add(new Label("Future Value:"), 0, 4);
rootNode.add(futureValue, 1, 4);
Button computeButton = new Button("Calculate");
rootNode.add(computeButton, 0, 5, 2, 1);
GridPane.setHalignment(computeButton, HPos.CENTER);
computeButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
calculateAndSetValues();
}
});
myStage.setScene(myScene);
myStage.show();
}
private void calculateAndSetValues() {
double amount = Double.parseDouble(investment.getText());
double interestRate = Double.parseDouble(rate.getText());
double numyears = Integer.parseInt(years.getText());
double finalAmount = amount * (1 + interestRate/12.0) * numyears * 12;
futureValue.setText("$" + finalAmount);
}
public static void main(String[] args) {
launch(args);
}
}

please upvote for the efforts i have put for this.
I need help with this code: Write a program that calculates the future value of an...
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,...
***Please use java code for the question below*** Write a program that calculates the future value of a given investment at a given interest rate for a specified number of years. The formula for this calculation is: value = investmentAmount * (1 + monthly interest rate)years*12 Use text fields for the user to enter the numbers (Investment Amount, Number of Years, and Annual Interest). To get/load data from the textbox, (in this case doubles) use the following structure: (bold are...
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...
Computing Future Investment Value Problem Description: Write a method that computes future investment value at a given interest rate for a specified number of years. The future investment is determined using the following formula: 12 futurelnvestmentValue investmentAmountx(1+ monthlylnterestRate) Use the following method header: publie static double futureInvestnentValue double investnentAmount, double monthlyInterestRate, int years) For example, futur Investmentvalue( 1eeee, อ.es/12, 5) returns 12833.59 Write a test program that prompts the user to enter the investment amount (e.g. 1000) and the interest...
CIT 149 JAVA 1 programming question? There will be two files for this problem. The first one, called FutureValue will hold the main method. The second file called FinancialUtils will hold the two methods that will display what the program will do, and perform the calculations. In the main method, which controls the logic of the program, you will first call the displayInstructions method which will display a statement of what the program will do. You will write this description...
please help me debug this Create a Future Value Calculator that displays error messages in labels.GUISpecificationsStart with the JavaFX version of the Future Value application presented in chapter 17. Create error message labels for each text field that accepts user input. Use the Validation class from chapter 17 to validate user input.Format the application so that the controls don’t change position when error messages are displayed. package murach.business; public class Calculation { public static final int MONTHS_IN_YEAR =...
Using basic c++ write a separate code for each of the following: 1. Area Rectangle • Write a program that asks the user to enter length and width of a rectangle and then display the rectangles area. • Write the following functions • getLength – prompt the user to enter length and return that value as a double • getWidth – prompt the user to enter width and return that value as a double • getArea – This method should...
Can someone help me write a retirement calculator program in c code. I want to write a program that the user can enter their age, amount they wish to save each month, the interest rate, and the age they wish to retire. I would like to use a switch loop, if else loop or do while loop. the output should show them how much they should have in a retirement savings account at the age they wish to retire at....
Posting this again because day limit has run out. Again I really
need help with this. This is for my Advanced Java Programming
class. The book we use is Murach's Java Servlet's and JSP 3rd
Edition. The program used is NetBeans IDE 8.2. I need help
modifying or adding some code. I will post the code I was told to
open that needs to be modified below.
Exercise 9-3 Use
JSTL to add a table to the Future Value
application.
In...
public static void main(String[] args) { System.out.println("Welcome to the Future Value Calculator\n"); Scanner sc = new Scanner(System.in); String choice = "y"; while (choice.equalsIgnoreCase("y")) { // get the input from the user System.out.println("DATA ENTRY"); double monthlyInvestment = getDoubleWithinRange(sc, "Enter monthly investment: ", 0, 1000); double interestRate = getDoubleWithinRange(sc, "Enter yearly interest rate: ", 0, 30); int years = getIntWithinRange(sc, "Enter number of years: ", 0, 100); System.out.println(); ...