There are two versions of the instructor's code for homework #1, a simple version and a complicated version. Both versions contain one class, Prime, and a main() method.
The first version is simple; all code is contained in the main() method, and ordinal numbers are printed in a very simple-minded way.
The second version is more complex; it contains a separate static method, buildArrayOfPrimes(), to generate an array of primes, and another static method, ordinal(), to generate the ordinal string (e.g., "first", "23rd") for any non-negative integer argument.
Each version has been placed in an appropriate package (com.bozoid.cis370.hw01.simple and com.bozoid.cis370.hw01.complex, respectively).
Here is the directory structure of the files for this homework, after the complex version has been compiled and javadoced. Note the separation of source files, class files, and documentation, and that the directory structure reflects the package naming.
D:\ \CIS370 \Code \classes \com \bozoid \cis370 \hw01 \complex Prime.class \simple \docs allclasses-frame.html allclasses-noframe.html ... index.html ... \com \bozoid \cis370 \hw01 \complex package-frame.html package-summary.html package-tree.html Prime.html \simple \sources \com \bozoid \cis370 \hw01 \complex Prime.java \simple Prime.java
Here are the commands used to build, run, and document the complex version:
cd d:\cis370\code javac -d classes sources\com\bozoid\cis371\hw01\complex\Prime.java java -cp classes com.bozoid.cis370.hw01.complex.Prime 1 java -cp classes com.bozoid.cis370.hw01.complex.Prime 3 java -cp classes com.bozoid.cis370.hw01.complex.Prime 4 java -cp classes com.bozoid.cis370.hw01.complex.Prime 77 java -cp classes com.bozoid.cis370.hw01.complex.Prime 8000 javadoc -sourcepath sources ^ -d .\docs\com\bozoid\cis370\hw01\complex ^ com.bozoid.cis370.hw01.complex
Here is the result of executing these commands:
D:\CIS370\code>javac -d classes sources\com\bozoid\cis370\hw01\complex\Prime.java D:\CIS370\code>java -cp classes com.bozoid.cis370.hw01.complex.Prime 1 2 The first prime number is 2 D:\CIS370\code>java -cp classes com.bozoid.cis370.hw01.complex.Prime 3 2 3 5 The third prime number is 5 D:\CIS370\code>java -cp classes com.bozoid.cis370.hw01.complex.Prime 4 2 3 5 7 The 4th prime number is 7 D:\CIS370\code>java -cp classes com.bozoid.cis370.hw01.complex.Prime 77 2 3 5 7 11 ... 367 373 379 383 389 The 77th prime number is 389 D:\CIS370\code>java -cp classes com.bozoid.cis370.hw01.complex.Prime 8000 2 3 5 7 11 ... 81749 81761 81769 81773 81799 The 8000th prime number is 81799 D:\CIS370\code>javadoc -sourcepath sources -d docs com.bozoid.cis370.hw01.complex Loading source files for package com.bozoid.cis370.hw01.complex... Constructing Javadoc information... Standard Doclet version 1.4.0 Generating docs\constant-values.html... Building tree for all the packages and classes... Building index for all the packages and classes... Generating docs\overview-tree.html... Generating docs\index-all.html... Generating docs\deprecated-list.html... Building index for all classes... Generating docs\allclasses-frame.html... Generating docs\allclasses-noframe.html... Generating docs\index.html... Generating docs\packages.html... Generating docs\com\bozoid\cis370\hw01\complex\package-frame.html... Generating docs\com\bozoid\cis370\hw01\complex\package-summary.html... Generating docs\com\bozoid\cis370\hw01\complex\package-tree.html... Generating docs\com\bozoid\cis370\hw01\complex\Prime.html... Generating docs\package-list... Generating docs\help-doc.html... Generating docs\stylesheet.css... D:\CIS370\code>