Write a program using JavaFX that calculates the future value of a portfolio at
ID: 3715909 • Letter: W
Question
Write a program using JavaFX that calculates the future value of a portfolio at retirement. The calculation for future value is: Future Value = Present Value * (1+r)n
Where:
Present value = initial investment amount
r = assumed rate of return
n = compounding intervals such as years
Here is an example: let PV = $250,000, r = 16%, and n = 18 years. FV = $3,616,000.d
Create a class called Equity to model the equity calculations and a class called EquityCalculatorWindow to handle the user interface. Use an Alert to display any input errors. See the Resources/stockCalculator.zip for an example of using an alert and also as a guide to the implementation. Disregard the use of message field in the example. All input values must be greater than zero. Inputs include Present Value, Rate of Return, and Years. Use a try-catch to handle the exceptions thrown by the methods in your Portfolio class. Format your output in dollars and ce
Explanation / Answer
import javafx.util.Scanner;
public class FutureValue {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double presentValue= 0;
double rate = 0;
double intervals = 0;
double futureValue = 0;
System.out.print("Enter the Present amount : ");
present = input.nextDouble();
System.out.print("Enter the Rate : ");
rate = input.nextDouble();
System.out.print("Enter the Interval : ");
time = input.nextDouble();
futureValue = (presentValue*(1+rate)intervals
if(futureValue!==0){
System.out.println("");
System.out.println("The futureValue is : "
+ futureValue);
}
else
catch(ArithmeticException e){System.out.println(e);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.