moved calculate method to abstract class and made it generic for Double and Float and added tests for Double precision