import javax.swing.JOptionPane; public class Interest { public static void main(String[] args){ double accrual; String input = JOptionPane.showInputDialog(null,"请输入收支余额:"); String input1 = JOptionPane.showInputDialog(null,"请输入利息率:"); double balance = Double.parseDouble(input); double interest = Double.parseDouble(input1); accrual = (int)(balance * (interest / 1200) * 100) / 100.00; JOptionPane.showMessageDialog(null, "The interest is " + accrual); } }
利用下面的公式计算下月的利息额
利息额=收支余额*(年利率/1200)
算利息
时间: 2024-11-05 14:46:22