Final Examination CS 141 Thursday, December 18, 1997 This is a closed-book, closed-notes examination. There are six problems. Do not spend too much time on any problem. Read them all through first and solve them in the order that allows you to make the most progress. For most of the problems, you need to write a program or a function. You do not need to write comments or include statements. Your program doesn't have to be fancy or user-friendly. You should make it as simple as possible, as long as it does what is required. In each problem, once you have written a function in one part of the problem, you may use the function in another part of the problem. ------------------------------------------------------------------------------ Problem 1 (10 points): Write a program to read in 100 integers, then print out all the positive numbers it read in, and after that print out all the negative numbers it read in. ------------------------------------------------------------------------------ Problem 2 (15 points): Write a function called count_t, that takes an input stream as input parameter. Assume that the input stream is already associated with a file containing words (with no punctuation, capital letters or numbers). The function should return the number of words in the file that begin with the letter t. ------------------------------------------------------------------------------ Problem 3 (35 points): A. Write a class called person, with data fields fname, lname and year_born, whose values will be the first and last name of a person and the year that person was born. Look at the other parts of this question to see what else the class should contain. B. Write a member function called age, for person, which takes the current year as input parameter, and returns the age of the person at the end of the current year. D. Write a member function called match, for person, which takes a first name and a last name as input parameters, and returns true if the person has that first and last name, false if not. ------------------------------------------------------------------------------