CS 202, Fall 2007 Assignment #7: 10 Points. Due Date: Tuesday, 11/6/07. (3) 1. In HW #3, Problem 3, the load() function of the Simpletron simulator was modified to read and load SML programs from a text file named "prog.sml". Each line of the SML program file consists of a 4 digit opcode and is terminated with a line containing the code -99999. Modify the input functions to read an optional text field comment of no more than 60 characters which follows the numeric opcode. Use the getline() member function (see pg 445 and Figure 15.6) to read the comment following the numeric opcode to the end of the line. The load() function must read and print each opcode followed by the comment field to create a listing of the SML program. The modified function must count the input lines in order to print line numbers before each line as the program file is read, and then run the program in the same manner as before. Test your modifications using the SML program Example 1 in Figure 8.40 (pg 466) run from a file. Include the opcode mnemonics shown in the text example as comments in the SML program file. Turn in the output from the test run along with the commented portions of the simulator source code which were modified.** (2) 2. Exercise 12.5. (2) 3. Compile and run the program st.cpp from the Lecture Examples on the course website. What happens when the line 'peoptr = &Fred;' is commented out? Why?** (2) 4. Modify the program st.cpp from the Lecture Examples on the course website to add a new class called "grad_student" which is derived from "student" and inherits attitude_is() from student. The grad_student attitude_is() should be: "Graduate students think CS is fun", but the grad_student class must NOT redefine the attitude_is() member functions from either base class. Modify the main program to create an object from the grad_student class and print the attitude directly and also by using a pointer to the grad_student class. The attitudes of the "people" and "student" classes must remain unchanged. Hand in your source code and program output.** (1) 5. Discuss why converting a base-class pointer to a derived-class pointer using a static_cast (compile-time downcasting) is considered dangerous. **For full credit, turn in fully commented program listings, including your name and the problem number, and the output from test runs exactly as produced by the program.