Suppose the tuition for a university is $5,000 this year and increases
4.5% every year. Write a program that displays the tuition for the next four
years. Display two digits after the decimal point.
public class Q1
{
public static void main(String args[])
{
double fee=5000;
for(int i=0;i<4;i++)
{
fee=(fee*0.045) + fee;
System.out.format("Increased fee for %d year = $%6.2f%n",(i+1),fee);
}
}
}
Comments
Post a Comment