Java project - class to calculate fructions