
You can copy the program below to test it.
import java.util.Scanner;
public class Example
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
String [] item = new String[2];
int [] num = new int[2];
for(int i=0; i<2; i++)
{
System.out.println("Which item are you shopping for?");
item[i] = input.nextLine();
System.out.printf("How many \"%s\" do you need?\n", item[i]);
num[i] = input.nextInt();
input.nextLine(); //Flush the "END OF LINE" symbol out
}
System.out.printf("%15s%10s\n", "Item", "Quantity");
for(int i=0; i<2; i++)
{
System.out.printf("%15s%10d\n",item[i],num[i]);
}
}
}