Project 0: Using GL
Due: Friday, February 10, 8:59:59pm
Note: there are no late submission folders for Project 0. Do this one on time.Objectives
The objective of this programming assignment is to make sure that you are set up to compile C++ programs and that you are able to run and submit your projects on GL.Introduction
In this project, you will go through all of the mechanical steps of submitting a C++ program on GL. If you have submitted programs on GL using shared directories (instead of the submit command), then these steps should be quite familiar.
Assignment
Step 1: link your shared directory
Follow the instructions on the Project Submission page to make a symbolic link to the shared directory in your home directory.
Even though you can read and write in your shared directories before the due date, you should NOT develop your programs in the shared directories. Furthermore, the files in the shared directories should NOT be your only copy of your programs. You should have a copy of your programs on your own computer or in a separate location in your GL account.
Step 2: write some functions for a knock-knock joke
Create a C++ file called joke.cpp and implement the three functions opening(), setup() and punchline() specified in the header file joke.h:
These functions simply have to return a string. When compiled with the following driver program,
This will be the typical situation for projects this semester. The project description will ask you to implement some functions (most often these will be member functions for a C++ class). You need to follow the specifications provided in the project description for each function. A main program may be given to you. This is mostly to check for compatibility for compilation and does not guarantee correctness. Your program will be graded by additional main functions. In general, you will not get to see these programs before submission, but just for Project 0, we will show you one:
This is to show you the importance of keeping the main() function in a separate file. If you put a main() function in joke.cpp then the grading program above won't compile with your joke.cpp and that would be a problem.
Step 3: create a Makefile
Create a makefile that compiles joke.cpp and driver.cpp separately with targets for joke.o, driver.o and driver.out (the executable).
In addition, add targets for run and clean to your makefile. The make run command should compile your program (if needed) and run driver.out. The make clean command should remove the .o files and the executable file.
If you have not used makefiles before, follow the steps in the Spring 2016 CMSC 202 Lab on Makefiles and Separate Compilation.
Implementation Notes
Each project has a section on implementation notes. These point out some issues that you might encounter while developing your code. You should look through the Implementation Notes before you start coding. The first time you look through them, they might not make too much sense. However, you should re-read the notes as you develop your program, because these notes are often mistakes the instructors made while developing the project. These notes often point out pitfalls with sharp spikes at the bottom. We don't usually intend to set traps for you. This is where we tell you how to avoid them.
For Project 0, there are only a few notes:
- The files joke.h, driver.cpp and
proj0test.cpp are available on GL in the directory:
/afs/umbc.edu/users/c/h/chang/pub/www/cs341.s17/projects/proj0files/ You can use the Unix cp command to copy the files, if you prefer. - You should not modify joke.h in any way. Your program will be compiled using the original version of joke.h.
- Yes, an empty string is a string, but your functions should not return an empty string. Even if your setup() function returns "I'm being eaten by a boa constrictor!", the punchline() function should return "mmmmf..." instead of an empty string.
- You should read through the coding standards for this class. They have been re-written to focus on intent. One intent is for you to follow some simple rules that make it possible to grade 200+ programs with only a little fuss. Other than that, you should put in some effort to make your code neat and readable.
What to Submit
You must submit the following files to the proj0 directory.
- joke.h
- joke.cpp
- driver.cpp
- Makefile
If you followed the instructions in the Project Submission page to set up your directories, you can submit your code using these Unix command.
Your copy of joke.h will actually be replaced by the original version during grading. Also, we won't use driver.cpp for grading. However, with those two files in the proj0 directory, you can go to the directory: