Prime Number Programs
As part of my project, I built 3 programs. All
of these programs were made by me in Java, and I really enjoyed
making them. Java is a free program, with lots of free documentation
and help files available. This was my first time doing extensive
programming, and I found Java easy to use. Another nice feature
about Java is that it is platform independent, which means that
I only have to write one program, and it will work on all computers
(Windows, Linux, Macintosh), provided they have the necessary free
software installed. Two of these programs I wrote work out of a
DOS command line, and sadly I can't demonstrate them on this site.
However, I will put up the code, a flowchart explaining the code,
and a brief explanation of each. If you know about java, then you
can compile this program, and run it from DOS. The third program
I made is a visual program, that I will put up for download, and
as long as you have the Java runtime software installed it should
run. You simply imput a number, and it tells you whether or not
it is prime.
The first program is called prime1. It tests a
number for natural number divisors, and if any are found, it displays
them, and tells you that the number is not prime. If no divisors
are found, it tells you that the number is prime. Here's a flowchart-

Fraser, 2007.
The following is a screenshot of the prime1 program
being run.

Fraser, 2007.
Click here to see the code for prime1, complete
with line by line explanations.
The second program is called primefinder.
It will find and list all of the primes between two set numbers,
such as 2 and 10,000. It has to test each number for primality,
and therefore it takes longer, but it still works quite well. At
the end, it tallies up all the primes found, and tells you how many
there are. 
Fraser, 2007.
The following is a screenshot of the primefinder
program.

Fraser, 2007.
Click here to see the source code for
primefinder.
My final program is a much more visual program.
Simply enter a number to test in the field, and then press "Test".
The program will tell you whether or not the number is prime.
Click here to download PrimeChecker1.0

Fraser, 2007.
|