Update MainClass.java

Added method calculate