package scannerinput;

import java.util.Scanner;

public class ScannerFix2 {
    public static void main(String[] args) {

    
    Scanner input = new Scanner(System.in);

    // get all inputs as strings with nextLine
    System.out.print("Enter quantity: ");
    String strQty = input.nextLine();
    int qty = Integer.parseInt(strQty);
    // or Double.parseDouble(), etc.

    /*
     * Each primtive type has a wrapper class: these are all in the 
     * java.lang package.
     * char: Character
     * byte: Byte
     * short: Short
     * int: Integer
     * long: Long
     * float: Float
     * double: Double
     * boolean: Boolean
     * They contain helpful methods and also some constants (such as the 
     * minimum and maximum values allowed)
     * The numberic wrapper classes, and Boolean, have parseXXX() methods:
     * e.g. Integer.parseInt(), Double.parseDouble(), Boolean.parseBoolean()
     * - each accepts a String value and returns a copy of that string 
     * converted into the appropriate primitive
     * e.g. Double.parseDouble("2.22") will return the double value 2.22
     * 
     * Note that each wrapper class is the same as the primtive type name 
     * except Integer (int) and Character (char).
     * DO NOT mistake the wrapper class for the primitive, e.g.
     * Double num = 2.2;
     * will work - no syntax or runtime errors - but it is NOT correct
     * - this creates an entire Double object, not a double primitive.
     * - a Double object takes up way more space in memory than a 
     * double primitive!!!
     */
    
    System.out.print("Enter product name: ");
    String name = input.nextLine();

    System.out.printf("Order %d %s\n", qty, name);

    input.close();

    }

}
