0

I want to build a command line interface with menus and sub-menus and eventually the leafs of the tree should be operations like.. bank management -> account management -> add acount (insert account info) And I'm looking for a good way which works with the OO principles...

Thanks for any piece of advice!

aclowkay
  • 131

1 Answers1

1

if you want OO I suggest a Menu interface with methods to write out the options and parsing the input and returning the next Menu

so your main loop becomes:

Menu menu = new StartMenu();
    while(menu.isExit){
    menu.writeOptions(stdOut);
    Menu res = menu.parseInput(stdIn.readline());
    if(res==null)
        writeError(stdOut);
    else
        menu=res;
}
ratchet freak
  • 25,986