Seperated simulate logic from Demo classe
Restored if-else as switch using string is not supported in 1.6.

Restored old logic as switch on strings is not supported in 1.6. As per
the note in https://piazza.com/class/hvzpk6p64fqax?cid=224. 1.6 is
supported
version of java we should use.
Restored old logic