CS A Assignments (2016-2017)

Fourth Quarter

  • Assigned on Monday, 22 May 2017; due by end of day 29 May 2017:

    Do 3x3 Grid Games Exercises 7a-d. Send your answers in an email addressed to jspurgeon@vcstudent.org with the subject "Tic-tac-T".

  • Assigned on Monday, 15 May 2017; due by end of day 5 June 2017:

    MODIFIED ON 5/16 and 5/22: Do 3x3 Grid Games Exercises 1-5 and 6a-c.
    For extra credit, do exercises 6e. For fun, do exercise 6d.

    Send your written responses to the exercises that pose questions in or attached to an email addressed to jspurgeon@vcstudent.org with the subject "Grid Games Written Responses". Send the html and JavaScript code for a single web program in the body of a separate email to jspurgeon@vcstudent.org with the subject "Grid Games Program".

    Your program code will be copied, pasted into the Grid Games "Editor", and evaluated based on what your program does after the "Render That" button is pressed. Test your program before submitting it for grading!

  • Assigned on Thursday, 4 May 2017; due by end of day 5 June 2017:

    Do exercises 1-10 on the Page Maker page. Submit your answers via email to jspurgeon@vcstudent.org with the subject "Page Maker".

  • Assigned on Thursday, 27 April 2017; due by the end of day Friday, 5 May 2017
    (yes, the same due date as the previous assignment!):

  • Assigned on Thursday, 20 April 2017; due by the end of day Friday, 5 May 2017
    (extended 1 week due to AP exam practice):

    Create a public Java class called SquareMatrix that has a main method. When the main method is executed, output should be produced as described below.

    Let N be the number of arguments (of type String) passed to the main method.

    If N is a perfect square (e.g. 4, 9, 16, etc.) and each argument can be converted to a floating point number, then the arguments should be interpreted as elements of a two-dimensional matrix M with n rows and n columns of floating point numbers, where n times n equals N, the first n arguments represent the elements of the first row of M, the second n elements represent the elements of the second row of M, and so on. In this case, the output should be n rows of n floating point numbers (adjacent numbers should be separated by a single space) representing the n by n matrix P, which is the product of multiplying matrix M by itself. Use two-dimensional arrays to represent the matrices M and P. Here is a Java 2D-array tutorial.

    If N is not a perfect square or if any argument cannot be converted to a floating point number, then the output should be the string "Invalid arguments".

    CHALLENGE (bonus points): Create a public class called SquareRootMatrix that outputs a message (e.g. "Invalid arguments" or "M does not exist") or a matrix M which, when multiplied by itself, produces the matrix P represented by the arguments passed to the main method of SquareRootMatrix.

  • Assigned on Monday, 10 April 2017; due by the end of day Tuesday, 18 April 2017:

    Go to the post titled “Algorithm 1.1E” and do Exercises 1-7 (listed at the bottom of the post). Send your answers to jspurgeon@vcstudent.org as an attachment to or in the body of an email message with subject “Algorithm 1.1E”. Clearly label your work with the exercise number followed by your answer for that exercise. To assist with this assignment and in preparation for the AP exam, review the following sections in Barron's AP Computer Science A.

    • From Chapter 1: Introductory Java Language Features
      • Types and Identifiers (p. 60)
      • Operators (p. 63)
      • Control Structures (p. 69)
      • Errors and Exceptions (p. 74)
    • Chapter 2: Classes and Objects (p. 92)
    • From Chapter 3: Inheritance and Polymorphism
      • Inheritance (p. 131)
    • Chapter 5: Program Design and Analysis (p. 207)
    • Chapter 7: Recursion (p. 290)

Third Quarter

Assignments that WILL be graded:

    [20 points] Assigned on 3 April 2017:
    • Convert the JavaScript implementation of Quicksort posted at http://javascriptpi.blogspot.com/2017/03/quicksort.html to Java.
    • Send your code to jspurgeon@vcstudent.org in the body of an email message. Use "Java Quicksort" as the subject.
    • Due by end of day Thursday, 5 April 2017.
    [bonus points] Offered on 3 April 2017:
    • Watch the first ten Donald Knuth Web of Stories videos beginning with Family history.
    • Watch at least ten additional Donald Knuth videos of your choosing.
    • Send an email to jspurgeon@vcstudent.org with a list of the titles of all of the Web of Stories videos you watched.
    • Write a letter to Donald Knuth. Proof read your letter very carefully. Treat your writing with the same care and thoughtfulness you would give to a job or college application.
    • Print your letter or very neatly write it by hand and sign it. Carefully deliver the signed letter to Mr. Spurgeon to be sent to Donald Knuth along with Mr. Spurgeon's own letter and letters from other students.
    • The number of bonus points awarded will depend on the quality and thoughtfulness of your letter.
    • Due by end of day Thursday, 5 April 2017.
  • [20 points] Assigned (to you individually) on 16 March 2017:
    • Due by the end of day, Monday, 20 March 2017...
    • Modify Sorter.pickySelectionSort so that it swaps only when necessary. Send your modified version of the method to jspurgeon@vcstudent.org in the body of an email message with the subject “Selection Sort Exercise”.
    • Also include an answer to the following question: Is your modified version of the method an improvement over simpleSelectionSort? Why or why not?
  • [at most 40 (+5 bonus) points] Assigned (to you individually and to your group) on 9 March 2017:
    • Due by the end of day, Tuesday, 14 March 2017...
    • [at most 5 points] As in previous exercises, review the questions about sorting and searching in your Barron's textbook. Make a list of the questions (identified by question number) that are related, directly or indirectly, to Bubble Sort.
    • Review, compile and execute the four implementations of Bubble Sort at http://jdkpi.blogspot.com/2017/03/BubbleSort.html and answer the following questions:
      1. [at most 5 points] What do the period (.) and s characters in the program's output correspond to?
      2. [at most 10 points] Describe the main distinguishing feature of each implementation/algorithm.
      3. [at most 10 points] Discuss the number of comparisons and swaps made by each implementation of Bubble Sort. Consider and discuss the best-, worst-, and average-case performance of each implementation/algorithm.
    • [at least -5 points] Send one email message per group containing your list of question numbers and the answers to the above questions to jspurgeon@vcstudent.org. The subject of your message should be "Bubble Sort Assignment". List the names of each team member in the body of your email message. Failure to follow these instructions exactly will result in a penalty of up to 5 points.
    • [at most 10 points] Each individual must meet with Mr. Spurgeon during class or at another prearranged time (prior to the due date) and demonstrate the ability to implement one of the variations of Bubble Sort studied in this assignment.
    • [5 bonus points (all or nothing)] Demonstrate the ability to implement all four variations of Bubble Sort studied in this assignment.
  • Assigned (to your group!) on 21 Feb 2017: Exercise[35].
    • Due by the end of day, Monday, 27 Feb 2017 (2 points).
    • Submit your work for the “Questions” and “Create Activity” sections of the exercise as follows: one member of your two- or three-person team should email the work for the entire team to: smeghashyam@vcstudent.org and sgonzalez@vcstudent.org, and copy: jspurgeon@vcstudent.org. The subject of the email message should be “Exercise[35]” (1 point). The names of the team members should be specified in the body of the email message (1 point).
    • If smeghashyam@vcstudent.org or sgonzalez@vcstudent.org is your email address, then Exercise[35] is optional for your team. You may choose to perform the exercise for a grade (which you will give yourself), or you may opt out of performing Exercise[34] itself. Instead of or in addition to performing the exercise, you must evaluate the work that other teams email to you. Meet with Mr. Spurgeon to discuss how to score the work of other teams and relay the scores to him.
  • Assigned (to your group!) on 13 Feb 2017: Exercise[34].
    • Due by the end of day, Thursday, 16 Feb 2017 (2 points).
    • Submit your work for the “Questions” and “Create Activity” sections of the exercise as follows: one member of your two- or three-person team should email the work for the entire team to: nkencke@vcstudent.org and jvxiong@vcstudent.org, and copy: jspurgeon@vcstudent.org. The subject of the email message should be “Exercise[34]” (1 point). The names of the team members should be specified in the body of the email message (1 point).
    • If nkencke@vcstudent.org or jvxiong@vcstudent.org is your email address, then Exercise[34] is optional for your team. You may choose to perform the exercise for a grade (which you will give yourself), or you may opt out of performing Exercise[34] itself. Instead of or in addition to performing the exercise, you must evaluate the work that other teams email to you. Meet with Mr. Spurgeon to discuss how to score the work of other teams and relay the scores to him.
  • Assigned (to your group!) on 2 Feb 2017: Exercise[33].
    • Due by the end of day, Wednesday, 8 Feb 2017 (2 points).
    • Submit your work for the “Questions” and “Create Activity” sections of the exercise as follows: one member of your two- or three-person team should email the work for the entire team to: mpande@vcstudent.org and jgodshalk@vcstudent.org, and copy: jspurgeon@vcstudent.org. The subject of the email message should be “Exercise[33]” (1 point). The names of the team members should be specified in the body of the email message (1 point).
    • If mpande@vcstudent.org or jgodshalk@vcstudent.org is your email address, then Exercise[33] is optional for your team. You may choose to perform the exercise for a grade (which you will give yourself), or you may opt out of performing Exercise[33] itself. Instead of or in addition to performing the exercise, you must evaluate the work that other teams email to you. Meet with Mr. Spurgeon to discuss how to score the work of other teams and relay the scores to him.

Second Quarter


Assignments that WILL be graded:
  • Exercise[32]
    • Assigned on Wed, 18 Jan 2017.
    • Turn in a hard copy of your work when you submit the remainder of your final exam next week.
    • Note: You may refer to your report while you complete your final exam.
  • Exam
    • Wed, 4 Jan 2017
  • Exercise[31]
    • Assigned on Wed, 7 Dec 2016.
    • Due by end of day Tue, 3 Jan 2017 (extended due to snow days).
  • Exercise[30]
    • Assigned on Wed, 30 Nov 2016.
    • Due by end of day Mon, 5 Dec 2016.
  • Exercise[29]
    • Assigned on Fri, 18 Nov 2016.
    • EXTENDED: Due by end of day Tue, 29 Nov 2016.
  • Exercise[28]
    • Assigned on Tue, 15 Nov 2016.
    • Due by end of day Fri, 18 Nov 2016.

Assignments that will NOT be graded:
  • Assigned on Friday, 20 Jan 2016—Review the following topics in preparation for next week's final exam. Come to class on Monday prepared to ask any questions you may have about any of these topics. ALSO: IF YOU MISSED CLASS, FIND OUT FROM SOMEONE WHO WAS PAYING ATTENTION IN CLASS WHY THE GCD ALGORITHM MIGHT BE IMPORTANT TO YOU!
    Donald E. Knuth and The Art of Computer Programming; tracing code by hand; problems, algorithms, and implementations; functions and methods, variables, parameters and arguments; objects, constructors, properties; while loops, for loops, and recursion; logical operators (&&, ||, !), bitwise operators (&, |, ~, ^, >>>, >>, <<), and mathematical operators (+, -, /, %), increment (++) and decrement (--) operators; arrays; the Math.random() method; output methods such as System.out.print and System.out.println; decimal to binary, binary to decimal, and binary to hex conversions.
  • Assigned on Monday, 12 Dec 2016—Study for test (moved to 4 Jan 2017 due to snow):
    swap, flip, recursion, Josephus Problem, cycle-shift, tracing code by hand, logical and bitwise operators, shift operators, while and for loops, arrays and ArrayLists, increment/decrement operators, Math.random method, modulus operator, ...
  • Assigned on Monday, 14 Nov 2016:

First Quarter