ITI1121. Introduction to Computing II
»» home :: directives ::
``The competent programmer is fully aware of the limited size of his own skull. He therefore approaches his task with full humility, and avoids clever tricks like the plague.'' Edsger W. Dijkstra
All assignments in this course are subject to all the following directives.

General

Consider using some combination of cloud-based storage (Google Drive, Microsoft One Drive, iCloud, Dropbox, Box, etc.) and external devices for backups. Hardware failure is not a good excuse for submitting late assignments.
  • Late assignments will not be accepted; they will receive a grade of 0;
  • Assignments must be done in teams of two or individually.

Handing an assignment

  • All assignments must submitted electronically using Brightspace.

    1. Carefully read and follow the guidelines for naming the files (specific to each assignment);

    2. Submit the files using Brightspace:

      uottawa.brightspace.com.

      Important note: File names containing special characters (ie. -,#,$,^,@, space, etc.) are known to cause errors with Brightspace.

    3. For teams of two students

      1. Only one of the two students submits a copy of the assignment using Brightspace;
      2. Clearly identify your partner and yourself.

  • Assignments that do not conform to the above procedure will not be marked;
  • Never upload the the byte-code files (files ending with the suffix .class); all the assignments are systematically re-compiled.

Identify yourself clearly on everything you hand in

Always include a class called StudentInfo having a method called display. For each team member, the method display prints on the standard output the following information.
  • Your name(s)
  • Student Number(s)
  • Course number and section if applicable, i.e. ITI 1121-A
  • The assignment number
Make sure to call the method StudentInfo.display() from the main method of all the drivers.

The above information should also appear in all of the following places:

  • at the beginning of each program/class (in comments)
  • at the beginning of each program's output (call to SudentInfo.display())
Example of a class header:
// Author: Tony de Peltrie
// Student number: 19850712
// Course: ITI 1121-G
// Assignment: 10
// Question: 41
	  

Restrictions

  • Everything you hand in must compile and run using the Java SE JDK 8.0 system on SITE's PCs;
  • The maximum grade for an assignment that does not compile is 30%;
  • You may only use features and library methods of Java that have been presented in class or tutorials at the time an assignment is due.

A note on the marking of code

Marks for code you submit in answer to a question are based on the code's correctness and quality (which includes clarity among other things). Each part of your solution (e.g. each method) will be assessed individually, relative to the conditions and requirements stated in the questions. For most programming questions you will be given a main program that aims to draw out as many bugs as possible. But it will not usually exhaustively test each part of your solution, so getting the overall program working correctly does not mean all the individual parts work correctly in all cases. Therefore you will not automatically get full marks for correctness just because the main program produces the correct output.

Programming standards

Use Javadoc comments

Each class, method, variable must be documented.

Java coding conventions

Your Java code should follow the standard code conventions for Java, as defined at this web site: Note that this is very detailed, and in many details it differs from what was done in ITI 1120. Read it all very carefully and be sure your program conforms to its requirements.

Identifiers

Identifiers should be as meaningful as possible and follow these conventions:
  • class and interface names begin with an upper case letter;
  • method and variable names begin with a lower case letter (except for the constructors);
  • if a class, interface, method or variable name consists of several words the words should be concatenated (not separated by underscores) and the second and subsequent words should start with an upper case letter (e.g. class StackArray, variable maxValueAtrribute);
  • names of constants (variables declared to be final) are all upper case and if they consist of several words, the words should be separated by an underscore (e.g. PI, MAX_VALUE);
  • a method name should begin with a verb (e.g. computeMaxmimum not just maximum);
  • a method whose primary purpose is to access an instance variable ("property", "attribute") should have a name that includes the variable's name, e.g.,
    getAttribute
    setAttribute
    isAttributeEqualTo(value)
    	      
  • (optional) when a formal parameter of a method is used to initialise an instance variable, Java programmers often use the same name for the formal parameter and the instance variable. This is done to emphasise the relation between the two variables.
    class Integer {
        private int value;
    
        Integer( int value ) {
            this.value = value;
        }
    }
    	      

Variables

  • Only declare variables that are actually used;
  • Do not allocate memory unless necessarily;
  • Do not use the same variable for different purposes;
  • Local variables should not be confused with instance variables: declare each variable in its appropriate place;
  • Every variable should have a comment describing its purpose. Be brief. This is called a data dictionary - it should be placed at the beginning of every method, either before or beside the declarations.

Program structure

  • Good structure is very important. Introduce your own abstract classes and/or interfaces and decompose your algorithms/methods into meaningful sub-algorithms/methods whenever this improves clarity.
  • Each method (including "main") should be preceded by comments describing its purpose and the algorithm it uses (if the algorithm is very simple, it needn't be described). These descriptions should be BRIEF.
  • Your program must be indented in a systematic way that reflects the nesting of its statements. There are good editors doing this automatically for you; ask your TA.

Input/Output

  • Output should be nicely spaced and easy to understand. In particular, it should be easy to understand the output without looking at the program listing. This means that for every value in your output you must print a short message explaining the meaning of the value;
  • Before your program reads values from the keyboard it must print a prompt describing what the user is required to enter.