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

Saint Louis University

Computer Science 150
Introduction to Object-Oriented Programming

Michael Goldwasser

Spring 2011

Dept. of Math & Computer Science

Homework Assignment 05

Functions, Exceptions

Contents:


Overview

Topic: Functions, Exceptions
Related Reading: Chapter 5
Due: 9:00am, Tuesday 8 March 2011

Please make sure you adhere to the policies on academic integrity.


Problems to be Submitted (20 points)

  1. (5 points)

    Write a function acronym(phrase) that accepts a string as a parameter, and returns a new string that includes the first letter of every word in the original phrase, all in uppercase. For example, a call to acronym('Laughing out loud') should return the string 'LOL'.

  2. (5 points)

    Exercise 5.25 on page 199 of the book.

  3. (5 points)

    Exercise 5.29 on page 199 of the book.

  4. (5 points)

    Exercise 5.34 on page 200 of the book (that is, an error-checking version of Exercise 5.23 of page 199)


Extra Credit

  1. (2 points)

    Write a function with signature convertBase(value,base) that takes a postive integer value and a base from 2 ≤ base ≤ 36 and returns a string representing the given interger value in that base (see discussion of Exercises 5.14 and 5.15 for algorithmic approach). As examples, convertBase(64180,16) should return the string 'FAB4', convertBase(18,2) should return the string '10010', and the call convertBase(789,10) should return the string '789'.

    (you do not need to do any error checking of the parameters for this exercise)


Michael Goldwasser
CSCI 150, Spring 2011
Last modified: Monday, 28 February 2011
Course Home | Assignments | Class Photo | Computing Resources | Lab Hours/Tutoring | Python | Schedule