Your code must contain your name and a description of the project your are attempting.
No folders, cover sheets, plastic containers. Just assemble the pieces of paper and staple them together and put it on the desk at the front of class room before class starts.
Do not worry about nice fonts, heading, decoration, or dingbats. I'm only interested in the text plus occasional diagrams. More important is identifying who you are and what the work is supposed to do at the start of the code.
Emergency delivery: use EMail and copy/paste your work into your message.
No copying -- unless you say where you got it. Even so -- check that it is a good solution to the given problem.
You should document who you are, what you are doing, and any help you get. Documentation should be included in the source code as far as you can. At the minimum each program must contain comments that identify who did the work and which project the program is tackling.
You do not have to hand in perfect work ... but you must document any errors (compilation, run-time, etc)
so that I can help you fix them.
On home systems you can probably print a screen shot. On our systems it is easy to generate a record of your compilation and run. The UNIX/Linux Command
scriptrecords everything you do and what the computer responds to it. It puts the results in a simple text file. This file is called "typescript". It stops recording when you send a CTRL/D character (Hold down the CTRL key and tap the letter D). In our labs the command
lpr typescriptwill print it out. The command
rm typescriptwill remove it. Here [ typescript ] is a sample of the Hello World program being compiled and run.
(P1): Pick a Programming Exercise from pages 29-30 and write, debug, etc. it. Make sure you program has a comment at the front stating who you are, which exercise you are doing, and what it should do. Start by downloading [ project.cpp ] a "fill in the blanks" program. Hand in what ever you have got by the start of class -- you can resubmit it with improvements if it is less than perfect.
(P2): Any programming exercise from chapter 2 except P2.22 (done in lab). You can also resubmit P1, if you did not get an A in it. Note: again the program should start explaining who you are and what it does -- copied from the book. Include a Script or screen shot of the comp[ilation and run.
(P3): Any programming exercise from Chapter 3 that does not need a loop. Programming projects 3.1 thru to 3.13 are suitable. Include the usual Script or screen shot. You can also resubmit P2, if you did not get an A in it. Note: again the program should start explaining who you are and what it does -- copied from the book.
(P4): Any Programming exercise from chapter 3 that has a loop. Programming projects 3.14 through to 3.30 are suitable. Include the usual Script or screen shot. You can resubmit P3, if you did not get an A in it. Note: again the program should start explaining who you are and what it does -- copied from the book.
(P5): A programming exercise from chapter 4. Must declare and define at least one function in addition to the main function. It should test the function in the main program. Note: again the program should start explaining who you are and what the function does -- copied from the book. Include a Script/screen-shot showing a compilation and test run. Resubmit P4, if you did not get an A in it.
(P6): Programming exercise from chapter 5 -- must have at least one class. The main program should declare at least one object in the class and test to see if it works. You can use <cassert> & assert(...) if you like. Your code should start with a comment saying who you are and what the class does. Include a Script/screen-shot showing a compilation and test run. Resubmit P5, if you did not get an A in it.
(P7): Resubmit P5 with at least one function in a separately compiled file (function.cpp) and only the header file (function.h) included in the main program. The function's file should be compiled with
g++ -c function.cppinto a ".o" file and the whole program compiled like this
g++ -o program program.cpp function.oNotice -- each file needs your name and its purpose defined in a comment. Include a Script/screen-shot showing compilations and test runs. You can resubmit P6 if you did not get an A.
(P8): Resubmit P6 (even if you got an A) with a UML diagram that shows every class in the code. You can resubmit P7 if you did not get an A.
(P9): Simple programming exercise from chapter 6 -- must have vectors or arrays. P9 may star in a question in the final examination. You may not resubmit P9. As before the program must start with a comment with your name, the number of the project in the book, and a copy of the books specification for the problem. Be very careful to make your code do precisely what the book states. If the book asks for a function that does something to a vector you must make sure that you have the function, with the right header, and it must do the right thing with or to the vector, and test it in the main program. Include a screen-shot or Script with a compilation and test run. All the programming exercises involve thought. If you think you have found a piece of code that solves the problem without you thinking about it you will almost certainly lose points. You can resubmit P8 if you did not get an A.
/* Author: A Student
Programming exercise P6.1
Write a function
double scalar_product( vector <double> a, vector <double> b)
that computes the scalar product of two vectors. The scalar product is
a0*b0 + a1*b1 + a2*b2 + ... a[n-1]*b[n-1]
*/In an emergency you could send the code (ASCII/.txt) with a subject like these
cs201/P1to my college EMail address. Copy and paste the code. See [Contact] at the top of this page.
There is absolutely no extra credit given for choosing a difficult project. Good programmers do not let their ego make things difficult for themselves: always do the simplest thing that can possibly work.
In a terminal window
Q p1.cppif the code is in file p1.cpp in your current working directory.
On other systems you may have to do the steps in 'Q' by hand:
g++ -o p1 p1.cppwill compile it and
./p1will run it. You can repeat the last compilation by typing
!g++into a terminal or use the arrow keys.
Or, for more complex projects with code in many files, you can create a Makefile by using any UNIX editor that contains lines like this
p1 : p1.cpp
g++ -o p1 p1.cpp(be careful to use the <Tab> key to indent the commands. Then the command
make testwill update p1 and then execute it for you. See [ make.html ] for details.
Each project is matched with an examination. In the examination you may have to answer questions about your latest project.
Recently, in CS201, someone desperately downloaded code from the internet that sounded like it might solve the problem. It did not. It got zero.
Again, in a recent Comp. Sci. course, one student got some code from his brother at another university and then let six friends copy it and make small changes. Six students handed in six variations of the code. It was a solution to a different problem. They all got zero.
Recently a student looked on Stack Exchange and thought he/she had found a solution to the problem. In fact, the question was different to the programming problem in the book. So he/she lost some points. If they had not told me where they got it I would have given it zero.
THINK. If you rush into code and patch it until it works you may score less than someone who takes time to think about the problem and possible solutions before writing the code. You can make notes using an editor. Start with: What are inputs and outputs? and/or the givens and goals? and/or the before and after conditions? How are these connected? Make notes on this analysis of the problem. What are some possible ways of solving it (designs or algorithms)? Choose one. Turn your notes into comments at the top of a program.
Make it Meaningful. It is up to you to use meaningful identifiers and comments that make it clear why the code is going to work. Do not hand in a separate algorithm or structure chart. Instead your file should include comments that show the design. A function definition should start with a comment saying (1) what it assumes and needs, (2) what it produces or guarantees, plus (3) a very brief algorithm. Make it clear and correct before you make it fast. Check all code before I grade it. If you have a bug: Add comments about the symptoms... remove the comments when fixed. If I find uncommented errors you will loose points. If I find things that I ca not understand then you will also loose points.
Most Errors occur when people (1) misunderstand the problem, (2) think of efficiency before correctness. Real problems are not obvious and are not clearly specified. The descriptions of the programs in the book are like this. There are several different programs that will fit what the book asks you to do. I leave the interpretation of them to you yet: (1) K.I.S.S. (= Keep It Simple!). (2) Demonstrate the features and topics described in the book and course at that time. (3) If in doubt A.S.K. (= Always Seek Knowledge). (4) Document (in comments) how you interpret the problem(Analysis)
Remote Access from Windows. You can access our system by using a Windows program called PuTTY -- it is free and easy to find on the web. It pops up a terminal. Connect the terminal to
jbh3-1.cse.csusb.edu(Port is 22). and log in normally. Remote access from Macintosh or Linux. Open a terminal and use the ssh firstname.lastname@example.org command.
Remote compilation. For security reasons you can not compile programs on "JBH3-1". You must access a lab machine from JBH3-1. You then will need to login to a lab computer like this
ssh jb358-10(you can use any of these machines from JBH3-1).
You will not be able to do graphic programs or use the GUI to make things easier. A key rule:
|cat >f||To upload or input a file called f. You can type in the code or copy/paste it from your machine. End with Enter and Control/D|
|cat f||To display the file f on your screen.|
|g++ -o p p.cpp||To compile a program called p|
|./p||To execute/run a program called p in this directory(.)|
|make t||to follow a recipe in Makefile to make t|
|cd d||to change working directory (folder) to d|
|pwd||to print working directory|
|ls||to list the file names in this directory|
|file *||to display info about the files|
|mkdir d||to make a directory called d|
|more f||to display a file f one screen at a time|
|rm f||to remove a file (dangerous....)|
|mv f n||to change name to n, or move f to another directory|
|cp f n||to copy f to file n|
|nano f||to edit a file called f (easy to use but not powerful)|
|vi f||to edit a file called f (powerful but not easy to use) [ vi.intro.html ]|
|emacs f||to edit a file called f (powerful and I can not help with it)|
|lynx u||View a web page with URL u while on JBH3-1.|
|links u||View a web page with URL u.|
|w3m u||View a web page with URL u.|
. . . . . . . . . ( end of section Notes on Projects for CS201) <<Contents | End>>