Added calculatePercentage()

Added percentage calculation function for analysis in the controller