added parts 1 and 2 and added error message for negative numbers