Summary: CMPS 282: Software Engineering, Spring 2010-11 Instructor: Paul Attie
Problem set 2 Due: Friday March11
Department of Computer Science American University of Beirut
This problems set concerns procedural abstraction. In particular, how to write specifications
and code sketches, and how to do functional decomposition. Actual programming is a minor
part of the problem set.
1 (30 points). It is well known that natural language contains a lot of redundancy, e.g., we
can delete every 5'th letter of a passage in English and still be able to understand it. We will
explore this issue by writing a program that replaces all vowels by the vowel 'i'. The program
should read input from a text file "in.txt" and write output to a text file "out.txt", which are
present in the same directory as the program. For sake of modularity and extensibility, your
program must consist of a top level method and a single helper method.
1.a (10 points). Write a specification and code sketch for the top level method. Be careful to
write a specification that deals with all possible exceptional conditions.
1.b (10 points). Use the code sketch of the top level method to deduce a specification for the
helper method. Based on this specification, write a code sketch for the helper.
1.c (10 points). Implement both methods and test your program. Provide several sample
runs (one for each test case). Include boundary test cases: empty input, input consists of one
character, etc., as well as "typical" test cases.
2 (50 points). This question concerns text justification. You are to specify, design, and write