Doing your work in CSC108H

The schedule of assignment due dates is given in the course information sheet distributed by your instructor. This guide tells you how to hand in your work, what to include in work submitted, and how the work will be marked. There is also a section on transferring marks from CSC 148H.

How to submit your assignments

Give your assignment to your tutor during the tutorial. Ordinarily only paper copies are accepted, not disks. Faxes are not accepted.

On your assignment, write your name, your student number, the date, the course number (CSC 108H1F), and your instructor’s and tutor’s names. Fasten the pages together securely.

Late penalties

Assignments are due at the beginning of tutorials. Some instructors allow late submission with various penalties, while others do not accept any late submission without written evidence of a problem such as illness. Find out the rules about lateness that apply to your section by reading the course information sheet.

Late submission—and excuses for lateness—should be discussed only with your instructor, not with your tutor, unless your instructor has explicitly said otherwise.

The work you submit must be your own.

People who write things are usually proud of what they have produced. Its quality reveals their ability, and its ownership may produce income or academic credit. It is wrong to take for yourself ownership of someone else’s work, and wrong also to allow your own work to stand in for someone else’s.

It is also an offence to permit another student to copy your own work. If you need advice on what is allowed and what is not, consult your instructor.

It is an offence under the University’s Code of Student Conduct to possess property that is not your own. This includes unauthorized copies of communications programs and of the programming environment used in CSC 108.

You may, of course, copy files provided by your instructor for particular assignments.

How to do well on your assignments

Your programming assignments will be marked by your tutor. Read this section carefully so that you won’t lose marks just because you didn’t understand what the tutor was looking for.

The marker’s basic questions

What you hand in will be judged not only on whether it works, but on how clear it is and on how well you show that it works.

The question "how clear is your program?" relates to the program’s style. When you have a choice to make in programming, make the choice that helps your tutor to understand what you’re doing.

In evaluating your testing, your tutor is asking, "Have you shown that your program works?" It may be obvious to you that your program must work. It is not obvious to anyone else. You must hand in the input and output from a systematic set of test runs so that your tutor can see why you think your program works.

The boxed section, below, shows some of the marking instructions given to tutors.

What to hand in

The next section, "How to prepare your assignment," describes the mechanics of producing the program and test output; here we discuss what kinds of things you should be aiming to hand in.

All assignments require you to submit two items: the program itself, and the test cases. In addition, some later assignments may require "external documentation."

Your program printout must be "paragraphed"—indented to show its structure. Many editors help you to indent, but you have to pay attention, to make sure the indenting follows your program’s real meaning.

The printouts of your test cases must include both the input and the output for each test. Annotate the tests so the marker will understand the meaning of each item. For example, beside a test run that demonstrates that a program works with the null string as input, you might write—by hand—"Input: null string. Works." Or, if your program fails to work with a negative number as input, you might write, "Negative input. Program fails." (In that case, you might also want to add a brief explanation of why the failure doesn’t matter or doesn’t affect the other test runs.)

Later assignments will likely need more description. It’s common to require "external documentation," meaning a supplementary report that describes how the program works, how it is organized, what tests you performed, and so on.

Your handins must include your name, your student number, your tutor’s name, your instructor’s name, the date, and the course number!

Some excerpts from the tutors’ marking guide

A working program gets at least 5 marks out of 10. One that does not function correctly, or that achieves too little of the requirements to be acceptable, should receive less than 5. A program is considered to be incorrect if:

Working programs are judged in these areas:

Completeness— The program should not only respond correctly in the standard cases but also deal with the required special cases.

Style— The stricter you are about style at the beginning of the course, the easier it will be for you to mark assignments towards the end—and the better your students will do in future courses.

Comments

Testing

How to prepare your assignments

All CSC 108 assignments involve creating a program and test cases. This section gives an overview of the major steps. More details about suitable commands are given in the handbook How to prepare programs on the Computer Science PC facility.

Preparing your program

You’ll type in your program (paragraphing carefully), run it and fix it using the programming environment CodeWarrior, which we’ll call CW here. Between sessions at the PC, you’ll save your work in files. (And you’ll save it frequently during sessions, too, in case of system failure!) When you’re finished, you’ll need to print the results for handing in to your tutor. Here we tell you what to print and how to print it.*

Most instructors prefer you to use CDF-PC’s "Print Java assignment" command to produce printed output. But they also accept printouts from other commands, since you won’t have "Print Java assignment" on your computer at home. In any case, even though Print Java assignment does some formatting for you, it is important to take some care yourself that your programs are formatted so as to be easy to read and understand.

Test data

What is a test file? At first, you test a program by running it within CW and typing test data as input. Then you just look at the output to see if it is right.

A test file is a file containing the data that you would type during a test run. For example, if your program requires a name and two numbers as input, you might type this:

	Jim
	12
	43.6

—and that’s exactly what should be in your test file.

Even though the contents of the test file obviously are not a Java-language program, you can still use CW to prepare the test file. Using CW’s "New Text File" command, open a window, type the desired test data, and save the file under a suitable name such as "test.dat".

Now you must get your program to take its input from the contents of test.dat instead of from the keyboard. The test output must go into a file, too. Don’t try to do this within CW; instead, use either the Print Java assignment command, or the Java Development Kit (JDK).

Using "Print Java assignment"

This command lets you run one program any number of times, each time with a different input file. Then it prints the program—just once—the input files, and the output files. You can also ask to preview the output, without necessarily printing it. See How to prepare programs on the Computer Science PC facility, page 10.

Using the JDK

If you’re working at home, you won’t have "Print Java assignment" available (because it uses various features of Windows NT that aren’t available in Windows 95 or 98). Instead, you must run your program on your test files directly with the JDK. See page 14 of How to prepare programs … for some information on getting the JDK and CW for your home computer.

The JDK provides two commands: javac (a compiler) and java (a Java Virtual Machine) that you can use in an msdos window. If you’re working with CW or another programming environment, you won’t need to use javac, but you will need java to run your program.

Here’s how to prepare an assignment for handing in while working at home:

	java Program < test1.dat > test1.out 
	java Program < test2.dat > test2.out

Why do my output files look funny? (The screen output looked OK!)

When you write a program that "looks good" while you’re typing the input yourself, some of the formatting depends on your pressing the Enter key at the end of each line of input. What happens is that the computer’s windowing environment is copying what you type to the screen as well as sending it to the program. However, when you redirect the input to come from a file, this copying doesn’t happen, so your output may be less attractive and informative. You can change the program so that it looks better—but then it won’t look as good when you type the input. Generally, you have to choose which way your program expects to work.

Your marker knows about this, and won’t take marks off for it.

Why is testing such a lot of work?

Using a program is much easier, usually, than writing it and making sure it works properly. The complicated steps involving the program text, the input files, and the output files are required because to be sure a program is correct one must examine both the "source code" written by the programmer and the results of test runs checking that the programmer was right. In fact, for full confidence in a program’s correctness, further steps are required, such as formal mathematical proofs, checks by several people, and other processes that are still the subject of research in computer science.