Programming Partners (Select by 10/26)

Current Assignment of Programming Partners

In this course you will be completing your homework with a programming partner. If you previously have taken CS1101 or CS1102, then you know how this model works. Students will work in the same pairs throughout the entire term. At the start of the term you may request to form a pair; we will pair up students who do not express preferences.

By structuring homeworks around teams, we hope to improve both the quality of the assignments as well as individual student learning. Programmers must learn how to work in teams and this is an opportunity to hone your teamwork skills.

You will need to send preferences for your homework partner (if you have any) to us. Send one email to the <csonger@wpi.edu> with both names (CCed to your partner); mention CS2102 in the subject line. Anyone who has not selected a homework partner by 5 PM Thursday October 26th will be assigned one. We will assign teams of two unless we end up with an odd number of students in the class. You may request a trio, but tell us who will work with someone else if we need to split off one person.

If you want us to assign you a partner, but do not want to be paired with a particular student (or two), in the above email include the name of the person you do NOT want to be paired with. Please make it clear in your message that you are asking to not be paired with the named student(s) in this case!

The final student pair programming teams will be announced in class on Friday October 27th.

Homework 1 (5 pts) [solutions]

Homework 2 (5 pts) [solutions posted]

Homework 3 (10 pts) [solutions posted]

Homework 4 (10 pts) [solutions posted]

Homework 5 (10 pts) [solutions posted]

Homework 6 (10 pts) []

 

Appropriate Test Cases

As you design more complex programs, it is imperative that you show you have tested the programs under numerous circumstances. A Test Case shows the execution of a program and compares expected output against actual program output. There are two cases to consider:

  1. If a program requires NO user interaction, then it is a simple matter to include in the main method of our program a set of test cases to show the satisfactory execution of the program. During the first phase of this course, your main method must provide a set of statements to validate the execution of the computation.
  2. In later phases, you will be introduced to JUnit
  3. if a program requires user interaction (for example, one that creates a Scanner object to read input from the user) then you must simply document that you have executed the program on a variety of scenarios, each of which is distinctly different. To explain to the TAs/SAs grading your assignment which test cases you considered, you need to document for each program the test cases that you executed. This documentation is placed in the class header documentation, as follows:

     
    import java.util.Scanner;
    
    /**
    * Program to determine if a number is even or odd.
    *
    * @author George Heineman (heineman@cs.wpi.edu)
    * 
    * Test Cases:
    * 1. 5 outputs "5 is odd"
    * 2. '4' outputs "4 is even"
    * 3. 'a' outputs an EXCEPTION
    */
    public class SampleTestCaseWithInput {
    
      /**
       * @param args
       */
      public static void main(String[] args) {
        // request input from user
        Scanner s = new Scanner (System.in);
        System.out.println ("Enter a number and I will tell you if it is even");
        int n = s.nextInt();
    
        // determine even or odd
        if (n % 2 == 0) {
          System.out.println (n + " is even.");
        } else {
          System.out.println (n + " is odd");
        }
      }
    }

Documentation Standard

Throughout the course, I document each code example using a standard that I have introduced informally. Here is a formal declaration of what I am expecting:

 
Documentation  for each Program At the top of the program file, include a comment explaining purpose of program and the author of the program

/**
 * Compute Area of Ring.
 * 
 * @author   George Heineman (heineman@cs.wpi.edu)
 */
public class ClassName {
}
Documentation for each Method
	
/**
 * Return TRUE if the digit is in the range '0' .. '9'; FALSE otherwise
 */
static boolean validDigit (char d) {
    .....
}
Documentation internal to each Method
public void someMethod () {
  ...

  // Create space for an array of three ints. Initial
  // values are all.... ?
  int [] ivals = new int[3];
		
  // access information from keyboard.
  Scanner s = new Scanner (System.in);
  
  ...
}
Within each method, do not overuse the internal comments; that is, do not say the following:

   i++;         // increment i by 1
Better to say (as we have shown with the while loop) a comment like
   i++;         // Advance loop