Question: I am inputting the following things:

* book
* 12.46
* music cd

For some reason, the prompt for cost comes up and the next output line comes on the same line. Could someone help me to spot my mistake?

```
public class SalesTax {

    public static void main(String[] args) {
        // Input items for shopping cart
        HashMap<String, String> cart = new HashMap<String, String>();

        // Create a Scanner
        Scanner input = new Scanner(System.in);

        // variables
        char done;
        boolean goods;
        double tax;

        // Pick items for list.
        do {       
            System.out.print("Please enter an item.");
            String item = input.next();

            System.out.print("Please enter the price for "+ item + ": ");
            String price = input.next();      

            if (item.contains("book")) {
                goods = false;  
            } else if(item.contains("chocolate")) {
                goods = false;
            } else if(item.contains("pill")) {
                goods = false;
            }

            cart.put(item, price);
            System.out.print("Would you like to continue to add items? (Type Y) for Yes and (Type N) for No.");
            done = input.next().charAt(0);

        } while(Character.toUpperCase(done) == 'Y');
    }
}

```

Answer: 
**problem:**

```
String item = input.next();

```

By the time you input `music cd` it will consume **music** by `item` and `price` will consume the **cd** thus skipping it.

**solution:**

you need to call `input.nextLine();` to consume the whole line of string
By default, `next()` just gets input upto a whitespace so you'd have to use `nextLine()` instead, which will read in the whole line of input upto a carriage return.