Saint Louis University |
Computer Science 1300
|
Computer Science Department |
Topic: Error Checking and Exceptions
Related Reading: Chapter 5.5
Due:
11:00am, Wednesday, 11 October 2017
Please make sure you adhere to the policies on academic integrity.
Exercise 5.23 on page 199 of the book involves a function with signature sliding(word,num). Re-read the description of that function and give a new version of the body of the function that does strict parameter checking to ensure that the parameters are valid for the purpose of the function. You do not need to (re)implement the core behavior of the function --- just the initial portion of the body that performs parameter checking.
Exercise 5.25 on page 199 of the book involves a function with signature pairSum(data, goal). Re-read the description of that function and give a new version of the body of the function that does strict parameter checking to ensure that the parameters are valid for the purpose of the function, presuming that all values must be integers. You do not need to (re)implement the core behavior of the function --- just the initial portion of the body that performs parameter checking.
Exercise 5.26 on page 199 of the book involves a function with signature toDecimal(string, base). Re-read the description of that function and give a new version of the body of the function that does strict parameter checking to ensure that the parameters are valid for the purpose of the function, however with the additional restriction that the base be at least two and most ten. Make sure to also validate that the string is a legitimate string for the given base. You do not need to (re)implement the core behavior of the function --- just the initial portion of the body that performs parameter checking.
Problem C above was made somewhat easier by only considering base ten and below. That ensured that only standard numeric digits could be used in a valid string. Redo that problem, but with more general setting where base can be up to 36. (Notice that for base 36, the largest digit allowed is 'Z').