Bryn Mawr College
CMSC 206: Data Structures
Fall 2017
Instructor: Deepak Kumar


Due on Tuesday, September 12, 2017

Title: Computing primes (& Prime Classes)

Assignment 2 (Due in class on Tuesday, September 12): Write a Java program to print out all the prime numbers between 1 and 100.

Required: Write and use a function isPrime() to tell if a number is prime or not.

Extra Credit: Students who enter college in a year that is a prime number and graduate, four years later, in a year that is also a prime number are considered in a Prime Class. For example, the class of 1997 is a Prime Class as both 1993 and 1997 are prime numbers. Write a program to compute and print out all the prime classes between 1900 and 2100.

What to Hand-in:

1. A print out of your Java program along with its output. Include the Extra Credit ONLY if it is complete.

2. Write a short reflection on your experiences with this assignment.

3. Staple all of these together and hand them in at the start if the class on the due date.

Back to CS206 Course Materials