create calculate method