To: The Summer 1998 CS 299 -Programming in Java- Class
From: Clifton, Scanlan
Date: June 09, 1998
RE: Program 1
Due Date: June 11, 1998 -Start of class
Grace Date: June 12, 1998 - 3:15 p.m., slide it under my door if I am not there!
Points: 25

You must turn in:
  • A) A diskette with and TPrime.html in the top-level directory
  • B) A print-out of your file

    This program should be quite simple and shouldn't take too long .... but it is your first one!!!
    Expect the programs to gradually get longer and harder!

    You are going to write a java applet to print out a table of prime numbers subject to the following requirements:
  • 1) The class name is TPrime.

  • 2) You must have a boolean function that takes an arbitrary integer as a parameter and returns true if the integer is prime, false if it isn't.

    Recall: An integer N is prime if N > 1 and N has no positive integer divisors except 1 and N.

  • 3) The table of primes is printed column-wise, in columns 40, 80, ... 440, with 20 rows per column, the rows being 16, 32, ... 320.
    This means:
    The table must start in row 16, col 40. (The first prime is 2). The next prime (namely 3) must be in row 32, col 40. The primes proceed down the first column with the 20th prime in row 320. Then the 21st prime starts in row 16, col 80. This continues on until the prime in row 320, col 440 is printed. Therefore, a total of 220 primes are printed ( 20 * 11 ). Just so you have a way to check your output, the 220th prime is 1373.

  • 4) You must use constants (final) for all numbers used except 0, 1, 2.

  • 5) In the html file, set the applet width to 480 and the height to 360.

  • 6) I'll say it this time, but not in the future (although it's always required): Follow the programming ground rules!