Create method to control a loop for the class requirements