Updating computeAndDisplayResult method