1

"I just want to show 2 digits after the decimal point in my future value textField"

"I am not sure where to try %0.2"

b.addActionListener(new ActionListener() {

    public void actionPerformed(ActionEvent e) {
        double IA = Double.parseDouble(for_ia.getText());
        double YEARS = Double.parseDouble(forYears.getText());
        double AIR = Double.parseDouble(for_air.getText());
        double FIA;
        FIA = (IA*Math.pow((1+AIR/100),YEARS));
        forFV.setText(String.valueOf(FIA));
    }
});
jaiv24
  • 43
  • 5
  • Possible duplicate of [Truncate a float and a double in java](https://stackoverflow.com/questions/10332546/truncate-a-float-and-a-double-in-java) – Kaan Oct 02 '19 at 03:22
  • format the number using the answer kaan provided, then feed the string to `forFV.setText(String.valueOf(FIA));` for your *I am not sure where to try %0.2*. – Bagus Tesa Oct 02 '19 at 03:34

0 Answers0