Answered step by step
Verified Expert Solution
Question
1 Approved Answer
my code runs but gives no output at all can you please check why.Please use netbeans and send me the output screenshots also.also please check
my code runs but gives no output at all can you please check why.Please use netbeans and send me the output screenshots also.also please check if my code alligns with the questions requirements properly and if you feel any change is required please make it in my code and attach the new code also
public class LoanPaymentCalculator extends Application
public static void mainString args
launchargs;
public void startStage primarystage
primarystage.setTitleCollege Loan Payoff Calculator App";
GridPane display preparedisplay;
addingWidgetsInTheDisplaydisplay;
Scene s new Scenedisplay;
sgetStylesheetsaddgetClassgetResourcestylecsstoExternalForm;
primarystage.setScenes;
primarystage.show;
private GridPane preparedisplay
GridPane display new GridPane;
display.setPaddingnew Insets;
display.setVgap;
display.setHgap;
return display;
public void addingWidgetsInTheDisplayGridPane display
TextField loaninput new TextField;
loaninput.setPromptTextEnter The Loan Amount";
loaninput.getStyleClassaddtextfield"; Correct class name
GridPane.setConstraintsloaninput,;
TextField rateinput new TextField;
rateinput.setPromptTextEnter The Interest Rate Amount";
rateinput.getStyleClassaddtextfield"; Correct class name
GridPane.setConstraintsrateinput,;
ToggleGroup termToggle new ToggleGroup;
forint x ; x ; x x
RadioButton timeButton new RadioButtonx years";
timeButton.setToggleGrouptermToggle;
timeButton.getStyleClassaddradiobutton"; Correct class name
GridPane.setConstraintstimeButton,x;
display.getChildrenaddtimeButton;
Button calculatebutton new ButtonCalculate;
calculatebutton.getStyleClassaddcalculatebutton"; Correct class name
GridPane.setConstraintscalculatebutton,;
Label resultlabel new Label;
resultlabel.getStyleClassaddresultlabel"; Correct class name
GridPane.setConstraintsresultlabel,;
calculatebutton.setOnActione handlingCalculationloaninput,rateinput,termToggle,resultlabel;
display.getChildrenaddAllloaninput,rateinput,calculatebutton,resultlabel;
private void handlingCalculationTextField loaninput,TextField rateinput, ToggleGroup termToggle, Label resultlabel
try
double loanamount Double.parseDoubleloaninput.getText;
double interestrate Double.parseDoublerateinput.getText;
double termselected Integer.parseIntRadioButtontermToggle.getSelectedTogglegetTextsplit;
double monthlypayment CalculatingMonthlyPaymentloanamount,interestrate,termselected;
resultlabel.setTextYour monthly payment is $ String.formatf monthlypayment;
catchNumberFormatException ex
resultlabel.setTextInvalid input, please enter again numeric value;
private double CalculatingMonthlyPaymentdouble loanamount, double interestrate, double term
double interestmonthly interestrate ;
double monthlyterm term ;
return loanamount interestmonthly Math.pow interestmonthly, monthlyterm;
style.css:
textfield
fxfontsize: ;
radiobutton
fxfontsize: ;
fxtextfill: #;
fxpadding: ;
fxbackgroundcolor: #fff;
fxbordercolor: #ccc;
fxborderwidth: ;
fxborderradius: ;
calculatebutton
fxbackgroundcolor: #CAF;
fxtextfill: white;
fxpadding: ;
fxborderradius: ;
resultlabel
fxfontsize: ;
fxtextfill: #ED;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started