计算10年后的学费
package lyt;
import javax.swing.JOptionPane;
public class Lyt1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
double fee=10000,sum=0,sum1=0;
for(int i=0;i<14;i++)
{
if(i<14&&i>9)
{
sum=sum+fee;
fee=fee+fee*5.0/100;
}
if(i<10)
{
fee=fee+fee*5.0/100;
sum1=fee;
}
}
JOptionPane.showMessageDialog(null, "十年后的学费为 " + sum1,"liangyanting",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(null, "四年内的总学费为 " + sum,"liangyanting",JOptionPane.INFORMATION_MESSAGE);
}
}