scanner wont scan
<p>Thank you for reading this. I am having trouble coding a hw program that is made to generate test with multiple choice and essay questions. Everything works except my program skips lines when it goes to read a part of the essay class. I know it has to do with the scanner and scan.nextline, scan.nextInt and scan.next, etc but I am confused on how exactly to fix it. </p>

<p>Thank you for your help. </p>

<pre><code>import java.util.*;

public class TestWriter
{
    public static void main (String [] args)
    {
        Scanner scan = new Scanner (System.in);
        String type=null;
        System.out.println ("How many questions are on your test?");
        int num = scan.nextInt ();
        Question [] test = new Question [num];
        for (int i=0; i &lt;num; i++)
        {
            System.out.println ("Question " + (i+1) + ": Essay or multiple choice question? (e/m)");
            type = scan.next ();
            scan.nextLine ();
            if (type.equals ("e"))
            {
                test [i] = new Essay ();
                test [i].readQuestion ();
            }
            if (type.equals ("m"))
            {
                test [i] = new MultChoice ();
                test [i].readQuestion ();
            }
        }

        for (int i=0; i &lt;num; i++)
        {
            System.out.println ("Question " + (i+1)+": "+ type);
            test [i].print ();
        }
    }
}
</code></pre>

<p>here is the essay class</p>

<pre><code>public class Essay extends Question
{
    String question;
    int line;
    public void readQuestion ()
    {
        System.out.println ("How many lines?");
        line = scan.nextInt ();
        scan.next ();
        System.out.println ("Enter the question");
        question = scan.nextLine ();
    }
    public void print ()
    {
        System.out.println (question);
        for (int i=0; i &lt;line; i++)
        System.out.println ("");
    }
}
</code></pre>
