PreLab 08

Due in class on Wednesday, April 6

Here are two questions that don't have much to do with Lab 08. This is another opportunity to get practice wrting code on paper.

  1. Write a program with two input loops. The first loop asks the user to enter a date. If the user enters anything but an empty string, the program then asks for the name of a person who has a birthday on that date. This continues until the user gives an empty string for the date. The second loop also asks for a date. If it gets the empty string the program terminates. If it gets an actual date it prints the names of all of the people it knows who have birthdays on that date. If it doesn't know anyone with a birthday on that date, it says so.

    Since you are doing this on paper, let's keep the input as simple as possible. The names can be arbitrary strings. For the dates, we will also use strings, such as "April 4" or "February 16". You can assume that the users are good typists, and that they always spell dates correctly.

  2. Write a function onlyLowerCase(s) that takes as an argument a string. The function should return a new string consisting of only the lower case letters of s. All of the capital letters, punctuation and spaces in s should be removed from the output. For example, onlyLowerCase( "I read the news today, Oh boy!" ) should return "readthenewstodayhboy".

Honor Code

If you followed the Honor Code in this assignment, write the following sentence attesting to the fact at the top of your homework.

I affirm that I have adhered to the Honor Code in this assignment.