24,860 views
41 votes
41 votes
It must ask the user to input the tuition for this year. Suppose the tuition for a university is 10000$ this year and increases 5% every year. In one year, the tuition will be 10500$. Write a Java program that displays the tuition in 10 years, and the total cost of four years’ worth of tuition after the tenth years

User Micole
by
2.8k points

1 Answer

16 votes
16 votes

Answer:

Answered below

Step-by-step explanation:

//Program in Java

int percentIncrease = 0.05;

Scanner scan = new Scanner(System.in);

System.out.print("Enter tuition: ");

int tuition = scan.nextInt();

double tenYearIncrease = (percentIncrease * 10) * tuition;

double tenYearsTotal = tuition + tenYearIncrease;

//Tuition in ten years

System.out.print(tenYearsTotal);

//Total four years after

double newTuition = tenYearsTotal;

double fourYearsIncrease = (percentIncrease * 4) * newTuition;

double fourYearsTotal = newTuition + fourYearsIncrease;

System.out.print(fourYearsTotal);

User Matthew Steeples
by
3.3k points