Created Factorial class for implementation.