Course Home | Assignments | Computing Resources | Lab Hours/Tutoring | Python | Schedule | Submit

Saint Louis University

Computer Science 1300
Introduction to Object-Oriented Programming

Michael Goldwasser

Fall 2017

Computer Science Department

Homework Assignment 06

Error Checking and Exceptions

Contents:


Overview

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.


Problems to be Submitted (18 points)

  1. (6 points)

    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.

  2. (6 points)

    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.

  3. (6 points)

    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.


Extra Credit

  1. (2 points)

    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').


Michael Goldwasser
CSCI 1300, Fall 2017
Last modified: Wednesday, 04 October 2017
Course Home | Assignments | Computing Resources | Lab Hours/Tutoring | Python | Schedule | Submit