Final Examination CS 141 Friday, May 8, 1998 This is a closed-book, closed-notes examination. There are five 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 each of the problems, you need to write a function. You do not need to write comments or #include statements. Assume that the type bool already exists. Your program does not have to be fancy or user-friendly. You should make it as simple as possible, as long as it does what is required. ------------------------------------------------------------------------------ Problem 1 (20 points): A. Write a function called sum_prod that reads in integers from the terminal, until their sum is greater than 1000. Then it returns their product. B. Write a program that reads in a word from the terminal, then writes the word back out to the terminal in reverse order. ------------------------------------------------------------------------------ Problem 2 (20 points): Write a function called reverse_file that takes an input stream and an output stream as input. Assume the streams are already associated with files. The input file contains not more than 100 integers. The function should make the output file contain the same numbers as the input file, except in reverse order. ------------------------------------------------------------------------------ Problem 3 (20 points): A. Create a class called date, with data fields for month, day and year. They should all be integers. For month: 1 means January, 2 means February, etc. Look at the other parts of this question to see what else this class should contain. C. Write a member function called get_month to return the month. ------------------------------------------------------------------------------