Hi Guys,
im a beginner in Java, and i have a problem to do:
the problem prompts the user 5 times to enter, the Name of a stock then the Share Price then the number of shares owned and we should calculate the sum of all the stock values, i wrote it using only two prompts using a loop, but my issue is that, in the second prompt time the loop Skips the String input for the second Name of stock instead of promting...bellow is the code:

import java.util.Scanner;
public class test1 {


public static void main(String[] args) {

Scanner input = new Scanner(System.in);
double sharePrice =0,stockPrice = 0, temp = 0 ;
int i = 0;
double sum=0;
String name;
while (i < 2)
{
System.out.println("Enter the Name of the Stock ");
name = input.nextLine();

System.out.println("Enter the Share price ");
sharePrice = input.nextDouble();


System.out.println("Enter the number of owned shares");
int numberOfshares = input.nextInt();
stockPrice = sharePrice * (double)(numberOfshares);


sum += stockPrice;

i++;
}
System.out.println("the total stockprice owned is: " + sum );
}


}

And this is the output i get:

Enter the Name of the Stock
nestle

Enter the Share price
2
Enter the number of owned shares
4


Enter the Name of the Stock
Enter the Share price