Can someone please help me and check my code

java

#1

Hello coders!

I recently began studying Java, and I’m afraid I hit a brick wall. I’m having trouble figuring out what’s wrong with my code, and I was wondering if anyone can help me out, I’d greatly appreciate it!
import java.util.Scanner;

/*
Predicting the future tuition
Suppose that the tuition for a university is $10,000 this year
and tuition increases 0.07 every year. After 11 years, the tuition
will be doubled.

Please write a program to

  • ask the user the initial tuition and yearly
    increase rate
  • calculate how many years the tuition will be doubled.

/
/

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package tuitionsolver;

/**
*

  • @author chichi
    */
    import java.util.Scanner;
    public class TuitionSolver {

    /**
    */
    public static void main(String[] args) {
    double initTuition = 10000;
    double increaseRate = 0.07;

     Scanner input = new Scanner(System.in);
     System.out.println("Please type in the inital tuition: ");
     
     initTuition = input.nextFloat();
     System.out.println("Plase type the increae rate: ");
     
     increaseRate = input.nextFloat();
     double finalTuition=initTuition;
     int years = 0;
     
     while(initTuition<20000){
         finalTuition = initTuition * 1.07;
         years++;
     }
     System.out.println("After " + years + " years, the tuition will be doubled.");
    

    }

}

THANK YOU GUYS PLEASE CRITIC ALL YOU WANT


#2

#3

#4

Were you looking for StackOverflow? Joining CC forums to get answers for your university questions is like going to a birdbath for a swim.


#5

#6