Spring 1998
Assignment 8
(due Friday 98.04.10 at 5 p.m. in room MCS 138)
-
[4 points] Exercise 7.22, page 311.
Modify the program given in this exercise as follows:
-
Add appropriate statements in "mystery2" so that the number it returns
is the number of vowels in the string stored in "string".
-
Do not add or remove any part in "main".
-
Before handing in your assignement, test your program on 5 different strings,
each with 10 to 15 characters. Show at least 3 test runs on your script.
-
[4 points] Exercise 7.30, page 315.
Modify the program given in this exercise as follows:
-
Add appropriate statements in "mystery3" so that the number it returns
is the length of the longest common prefix of "string1" and "string2".
If the longest common prefix of "string1" and "string2" is empty, i.e.
they have no common prefix, "mystery3" should return 0.
-
Do not add or remove any part in "main".
-
Before handing in your assignement, test your program on 5 different pairs
of strings, where each string has between 10 and 15 characters. Show at
least 3 test runs on your script.
Assaf Kfoury
Created: 98.04.03