Assignments

Here are the programming assignments and final project. The assignment FAQ answers many common questions related to the programming assignments. Weekly programming assignments are due on Sundays at 11:59pm Princeton Time. The Dean's Date final project is due on Wednesday, May 5 at 5:00pm Princeton Time.

DUE LOGO ASSIGNMENT COLLABORATION SUBMIT
NEW in Spring 2021: We are introducing the COS 126 Style Guide.
Sun 2/7
11:59pm Princeton Time
Hello, World (Files)
Install a Java programming environment, write a few short Java programs, and submit them using our submission system.
This is an individual assignment. Submit!
Sun 2/14
11:59pm Princeton Time
Conditionals & Loops (Files)
Write several short Java programs to gain practice with loops and conditionals.
This is an individual assignment. Submit!
Sun 2/21
11:59pm Princeton Time
N-Body (Files)
Simulate the motion of n particles, mutually affected by gravitational forces, and animate the results.
This is an individual assignment. Submit!
Sun 2/28
11:59pm Princeton Time
Conjunction Function (Files)
Implement and test a collection of functions.
This is an individual assignment. Submit!
Sun 3/7
11:59pm Princeton Time
Recursive Graphics (Files)
Create a library of geometric transforms on polygons; plot a Sierpinski triangle; and plot a recursive pattern of your own design.
This is an individual assignment. Submit!
Sun 3/21
11:59pm Princeton Time
Hamming Codes in TOY (Files)
Write a TOY program to encode data using Hamming codes. Then write a TOY program to correct encoded data that has been corrupted.
You can work with a partner on this assignment.
Submit!
Note - do not include name/netid/precept in comments


Leaderboard
(results)
Sun 3/28
11:59pm Princeton Time
Classifier (Files)
Write a program to classify images using the perceptron algorithm.
You can work with a partner on this assignment. Submit!
Sun 4/4
11:59pm Princeton Time
Perceptron (Files)
Implement the perceptron algorithm.
You can work with a partner on this assignment. Submit!
Sun 4/11
11:59pm Princeton Time
Guitar Hero (Files)
Simulate the plucking of a guitar string using the Karplus–Strong algorithm, transforming your computer into a musical instrument.
You can work with a partner on this assignment. Submit!
Sun 4/18
11:59pm Princeton Time
Traveling Salesperson Problem (Files)
Implement two greedy heuristics to find good (but not optimal) solutions to the traveling salesperson problem.
You can work with a partner on this assignment. Submit!

Leaderboard
(results)
Wed 5/10
5:00pm Princeton Time
Atomic Nature of Matter (click here for assignment specs) ( Slides) (Checklist) (Files)
Re-affirm the atomic nature of matter by tracking the motion of particles undergoing Brownian motion, fitting this data to Einstein's model, and estimating Avogadro's number.
You can work with a partner on this assignment. Submit!
With special thanks to Kathleen Ma '18 and Ilene E '21 for creating these wonderful assignment logos.