I'm making a simple program in Java, in which ask the user:
- initialBalance, double
- rate, integer
- client, String
I have a problem: the first two inputs work, but I cannot make the third to function, the program seems to skip it.
This is the code:
import java.util.Scanner;
public class DoublingTime{
    public static void main(String[] args){
        Scanner console = new Scanner(System.in);
        System.out.print("Initial sum: ");
        final double initialBalance = console.nextDouble();
        System.out.print("Interest rate: ");
        final int rate = console.nextInt();
        System.out.print("Client name: ");
        final String client = console.nextLine();
        
        double balance = initialBalance;
        int year = 0;
        while(balance < 2 * initialBalance){
            balance = balance + balance * rate / 100;
            year++;
        }
        System.out.println("To double the investment of " + client + " (interest rate of " + rate + "%) " + year + " years are needed.");
        console.close();
    }
}
And this is what I get on my GUI:
Initial sum: 10000
Interest rate: 1
Client name: To double the investment of (interest rate of 1%) 70 years are needed.
What am I doing wrong?
