Console app accept multiple user input to build objects of a class
<p>What would be the cleanest way to code the retrieval of user input inside a <strong>main()</strong>?
The way I want it to work is something like that:</p>

<p><strong>Enter name:</strong> <em>(user's input)</em></p>

<p><strong>Enter date of birth:</strong> <em>(user's input)</em></p>

<p>Then depending on the type of the object(if it's Instructor - ask for salary, if it's Student - ask for name of the major) ask for any additional info specific to the type of the object.</p>

<p>Class structure:</p>

<p><strong>Person</strong> is a normal superclass. <strong>Intructor</strong> and <strong>Student</strong> are both subclasses of <strong>Person</strong> class.</p>

<p>I can do exception handling myself, just can't formulate adequate logic for looping input. Also if user enters 'q', the program should quit.</p>

<p>Person</p>

<pre><code>package com.exercise.inheritance1;

import org.joda.time.LocalDate;

public class Person {

    protected String name;
    protected LocalDate dateOfBirth;

    public Person(String name, LocalDate dateOfBirth)
    {
        setName(name);
        setDateOfBirth(dateOfBirth);
    }

    private void setName(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return this.name;
    }

    private void setDateOfBirth(LocalDate dateOfBirth)
    {
        this.dateOfBirth = dateOfBirth;
    }

    public LocalDate getDateOfBirth()
    {
        return this.dateOfBirth;
    }

    @Override
    public String toString()
    {
        return String.format("%s: %s\n%s: %s",
                "Name", this.getName(), "Date of Birth", this.getDateOfBirth());
    }


}
</code></pre>

<p>Instructor</p>

<pre><code>package com.exercise.inheritance1;

import org.joda.time.LocalDate;

public class Instructor extends Person {

    private double salary;

    public Instructor(String name, LocalDate dateOfBirth, double salary)
    {
        super(name, dateOfBirth);
        setSalary(salary);
    }

    private void setSalary(double salary)
    {
        this.salary = salary;
    }

    public double getSalary()
    {
        return this.salary;
    }

    @Override
    public String toString()
    {
        return String.format("%s\n%s: %s",
                super.toString(), "Salary", this.getSalary());
    }

}
</code></pre>

<p>Student</p>

<pre><code>package com.exercise.inheritance1;

import org.joda.time.LocalDate;

public class Student extends Person {

    private String major;

    public Student(String name, LocalDate dateOfBirth, String major)
    {
        super(name, dateOfBirth);
        setMajor(major);
    }

    private void setMajor(String major)
    {
        this.major = major;
    }

    public String getMajor()
    {
        return this.major;
    }

    @Override
    public String toString()
    {
        return String.format("%s\n%s: %s",
                super.toString(), "Major", this.getMajor());
    }

}
</code></pre>

<p>Run(main)</p>

<pre><code>package com.exercise.inheritance1;

import org.joda.time.LocalDate;
import java.util.Scanner;


public class Run {
    public static void main(String args[])
    {
        Scanner userInput = new Scanner(System.in);

        do
        {

        }while(!userInput.hasNext("q"));
    }
}
</code></pre>
