CIMP7A java documentation is modeled after the standard JavaDoc - JavaDoc documentation standard is covered in CS4B.

All programs you write must meet our documentation standard. The standard is critical for the following reasons:

- Most students who take cimp7a Java are still coming up to speed on programming logic. Developing good programming logic skills that also must meet a Java Syntax requirement is not an easy task. To simplify this one must first write all logic in the standard english language. You then translate the english logic into Java.

- All major software system have strict input/output specifications. The reason are able to have muliple browser (i.e., Chrome, FireFox, Opera, Safaria and IE) all on the same input (i.e., Web Page) is that they all have to meet multiple (i.e., CSS, JavaScript, HTML, Compression) standards. The assignments are not exception, you can easily be penny wise and pound foolish by not first identifying the input and output specification for each assignment. Students who have too many submit attempts can loose points. You need to first identify the input, then the output, and make sure you program outputs the example same contents as the sample runs. Each assignment has sample runs, and clearly specifies the input and output.

- Any experience programming realized the importance of documentation. If you have ever written or encountered large software systems, unless the code is well documented you can come up to speed on it. One of the main reasons for Java success was the early implementation of JavaDoc across all Java APIs. You may want to review the java.lang.System documentation, all comments in the documentation are derived from the Java program /** .. */ comments - Full Java 7 Standard Edition API. Note I'm using the same standard in a HPCalculater assignment used in CS4A and TicTacToe for CS4B.

Standards

- Before the signature of your class name you need to add a /** ...... */ comment, Note NetBeans automatically creates ths /** @author comment */.
- Inside the comment we will have 4 JavaDoc Annotations: (@input @output @logic @author). Later on when we write methods we will use the @param, and @return JavaDoc annotations.
- Each JavaDoc annotation is self descriptive @input is the input, @output is the output, @logic is the english logic to go from input to output.
- It is very important to first understand the input and output specification of each assignment. Read assignment then derive what is the input, what is the output.
- Once you are clear on input and output, write the english logic that is required to go from a given input to the specfied output.
- Make sure you use in-line comments (i.e., // after variables and key programming steps)
- In general javaDoc we document each class and method, precisely stating this is the input and this is the output. For beginners its a very good idea to frequently use inline comments (i.e., // after variables and before programming steps), remember you know English and are learning Java, so use what yo know first English.

For example, Submit file name TripleInteger.java

Program with correct documentation

```
/**
* Read an integer from standard input, integer read is guaranteed
* to be between -2^20 to 2^20, this is important because program
```

* doesn't have to worry about overflow, a Java int uses 32bits,

20 bit input so we are safe. After reading the integer

just output the the number read and its tripled valued.

* Sample Run...

25
The number 25 tripled is 75

* @input integer n from Standard Input System.in
* @logic take input n multiply by 3, in output statement its n*3
* @output: "The number n tripled is n*3\n" Where n is integer just red
* @author jstudent0
*/
public class TripleInteger {
/**
* input integer n triple it, does all the work
@param args
*/
public static void main( String[] args )
{
int n; //integer to be read
//use default standard input stream create formatted input stream
java.util.Scanner input = new java.util.Scanner( System.in );

n = input.nextInt( );
System.out.println( "The number " + n + " tripled is " + n*3 ); //output
//println will terminated the line with a newline characters
} //end main
} //end class TripleInteger

Submit CertificateDeposit.java (Heavily commented program with most code removed)

```
/**
* Given an initial $1000.00 investment, Program allows a use to enter
* an annual interest rate, and the term of a CD in months, it then
* outputs the future value of the $1000.00 CD at end of term.
*
* @input read annual interest rate and term of CD in months (all double) from stdin
* @logic future value = ($1000.00)*(1+AnnualRate/1200)^months
```

* since we are compounding monthly, we divide annual rate by 12, to go from
* a percentage to a floating number we divide by 100. e.g., 1% = .01
* so we have Fv = PV * ( 1 + AnnualRate/(12*100)) ^ months; where 1 is 100%
* using printf to print 2 digits past decimal point for initial value
* future value, and annual rate, its printf("%.2f",100); --> 100.00
* @output the value of a $1000.00 CD at end of term
*
* @author tdedonno2
*/
public class CertificateDeposit {
/**
* main method does all work of program
*/
/*
* not we only use ** before class names, methods and global variables
* this program has way too many comments, but beginners should always
* over comment than under comment
*
* Data Table
* constant double PV = 1000.0 Present (aka initial) Value
* double rate annual interest 10% is stored as 10 not .01
* double term number of months for investment
* double fv Future value calculated
*/
/* declare constants
use keyword final before double, to create double constant */
//declare other variables all double
//annual rate and term in months for investment
//create formatted input stream
//Prompt use for annual interest rate & then months
; //enter rate
//Prompt user for term
/*
* using formatter System.out.printf
* where "%.2f" will print 2 digits pass decimal point,
* it is recommended you test this printf first
* System.out.printf( "An initial investment of $%.2f at rate %.2f%%\n",
* 1000.0, 2.566 );
*
* Given a 12 month 1.2 rate, The output string you need to create is...

"An initial investment of $1000.00 after 12 months at annual rate of 1.20% is $1012.07\n"
*/
/*
complete next portion of output use use %.0f term and %.2f%%
for annual rate, note in printf %% will output % */
/**
calculate the final value using
PV * Math.pow( (1.0+rate/1200.0), term );
note we have 12 months / year so we divide by 12
but an interestRate of 10% is the double 10/100
so we need to divide by 12*100 aka 1200
Equation:

http://home.ubalt.edu/ntsbarsh/business-stat/otherapplets/compoundcal.htm
*/
//output the final string using %.2f\n new line terminated
} //end main
} //end clss CertificateDeposit