CSE 9A UCSD Fall, 1996 Assignment 1 (Note: All references to Unix directories assume that you are starting in your home directory in your account for this courses on icse1, also called sdcc8.) Required reading: Reichard book Chapters 1, 2, 3 and those sections of Chapter 6 that cover the vi editor (or if your are using some Unix book other than Reichard read the sections on basic Unix and the section on the vi editor.) Also, Savitch text Chapter 1. Programming: Due date (midnight) Thursday October 3, 1996: Programming Projects 1, 2, and 3 in Chapter 1 of the Savitch text (page 33). First do Project 1, then modify the program from Project 1 as described in Programming Project 2, and finally modify the program from Project 2 as described in Programming Project 3. (When doing Project 3 be sure to use the program from Programming Project 2, not Programming Project 1. Even though the texts say you can use either Project 1 or Project 2, you cannot; for this assignment you must use Project 2 when doing Project 3.) The result of Programming Project 3 is the only thing you will turn in. You only turn in one program. Programming Projects 1 and 2 are only steps on the way to Programming Project 3. You will use the "turnin" program to turn in your program. This turnin program will take the file you give it and place that file in a directory where we can grade it. You can do this at any time on any day before the deadline. To turnin in an assignment with the turnin program proceed as follows: Suppose the program you want to turn in is in the file hw1.cxx. Simply type in the following (while in the same directory as the file hw1.cxx): turnin -c cs9f hw1.cxx Be sure to use all lowercase letters as shown here. Be sure to put spaces where shown. (The number of spaces does not matter). To turn in a file with a name different from hw1.cxx, simply replace the name hw1.cxx in the above example, with the name of the file you want to turn in. Note: (1): You will always be turning in a C++ program. You should compile it and test it, but when you turn it in, you only turn in the C++ program, you do not turn in the compiled object code. (We will compile your program and run it when we grade it.) (2): If you turnin two files (before the deadline), only the last one turned in will be used. So, if you decide that you did the assignment incorrectly and want to redo it, simply redo the assignment and use the turnin program again (but before the deadline). (3): To learn more about the turnin program, type the following at the Unix prompt: help turnin IMPORTANT: After you turn in your program for this or any other assignment, do not edit it or in any way modify the file that contains your homework assignment. This will ensure that we can check that you did the assignment on time if the turnin program fails. If you want to use your program, make another copy of the program using the cp command. You safely change this second copy. Your programs will be graded (at least partly) by another program. The grading program expects your program to behave in certain ways and will reject it unless it behaves exactly as expected. Be sure to follow the instructions for input and output exactly. Otherwise, you will not receive credit for the assignment. To see what the input/output behavior of your program should be, you can run the object code in hw01.o. We have already done this assignment and compiled the program. The file hw01.o has the object code produced when we compiled our solution. You cannot see the C++ code for our solution, but you can run the object code and see how your program should behave. The following command will copy the file hw01.o to your home directory: cp ../public/assignments/hw01.o . Do not forget that final dot (period). After you copy this file to your directory, you can run the object code by typing: hw01.o The compiled version of the program you turn in should have the same input/output behavior as hw01.o. (Note: that this program is suppose to give an incorrect answer as discussed in Programming Project 3; so do not be surprised if you get an incorrect answer when you run hw01.o.) We will provide you with object code (like hw01.o) for each assignment so that you can see exactly what the input/output behaviors of your program should be. However, having the right input/output behavior is not enough to get full credit. This program and all your programs must follow the examples of the programs in the Savitch text for style. This assignment is based on the program in Display 1.8 of the Savitch text. All the programs in that text are in the directory ../public/programs So you can get a copy of the program in Display 1.8 by giving the following command from your home directory at the Unix prompt: cp ../public/programs/ch01-02/01-08.cxx . Do not forget that final dot (period). If you start with this file, that will save you some typing, but if you are unfamiliar with the text editor, you might want the practice of typing in the program yourself. Assignments 2, 3, etc. There will be approximately one assignment per week. Assignment 2 will be due very soon after Assignment 1, so start early. Assignments 2, 3, and so forth will be posted in the following directory on the course computer: ../public/assignments