Put all necessary functions/methods in main.cpp.
Fixed errors in main.cpp.
Need to debug range error in void calculate