CSE 305 Programming Languages Fall, 2003 Professor Shapiro Homework 11 Maximum Points: 6 (plus a possible 3 bonus points) Due 9:00 am, Thursday, December 4, 2003 Copy this file to a text file named hw11.txt, edit into it your answers, and submit the file via the submit program by the deadline given above. 1. (3) In the class web notes on Subprograms (http://www.cse.buffalo.edu/~shapiro/Courses/CSE305/notes10.html), in the section on "Function Parameters", there is a C function called printTable. printTable takes a function and an array, and prints a table of the integers in the array and the results of calling the function on that integer. printTable is tested in main by passing it a doubling function and a squaring function, each with an array of the integers 1 - 5. Write a Java version of this C program. Come as close as you can to copying the style of the C program. Hint: Consider an abstract class with one method called Apply. If f is an object of this class, consider f.Apply(5). Include below this paragraph your program and a copy of your test compile-and-run. 2. (3) Do Problem 6 of Chapter 13 of the text (page 539-540). For each possible different final value of Buf_Size, you only need to show one sequence of events. 3. (3 bonus) Write a Prolog program, so that, if you query a month number, N, the program prints the name and length of the Nth month. For example, | ?- month(5). May has 31 days. yes Note: an appropriate printing relation is format("~s has ~d days.~n", [Name, Length]) There must be only one occurrence of the format predicate in your program. Include below this paragraph your program and a copy of your test run.