A Programming Approach to Corporate Financial Management