RU beehive logo ITEC dept promo banner
ITEC 120
2008fall
aaray,
ejderrick,
ibarland,
jmdymacek

homeinfolabshwsexams
textbookjava.lang docsjava.util docsarchive

lect03c
Writing javadoc; declaring fields

Reading: §3.2, 3.3, 3.4 .

The most important javadoc tags are the one mentioned in the book:

There are a couple more handy javadoc tags used on a per-file basis, at the very start of a file:

Example:

/** Functions to calculate the area of pizza purchased, given a diameter.
 *
 * @author Ian Barland
 * @version 2007.Jan.10
 */
class PizzaServer {

  /** Calculate the area of a pizza, given its diameter.
   * @param diam The diameter of the pizza, in inches.
   * @return The area of the pizza, in square inches.
   *    (test cases omitted, to fit on one screen in class)
   */
  double pizzaArea( double diam ) {
    double radius;
    radius = diam/2;
    return 3.14 * radius * radius;
    }


  /** Calculate the are of *topping* on a pizza, given its diameter.
   *  Krusteaze pizza has 3" of crust all the way around.
   * @param diam The diameter of the pizza (in inches); must be 6 or more.
   * @return The amount of topping (in square inches)
   *    (test cases omitted, to fit on one screen in class)
   */
  double toppingArea( double diam ) {
    double toppingDiam;
    toppingDiam = diam - 2*3;
    return this.pizzaArea( toppingDiam );
    /* We subtract the part of the diameter which is crust: 3" on each side. */
    }


  /** Calculate the are of *crust* on a pizza, given its diameter.
   *  Krusteaze pizza has 3" of crust all the way around.
   * @param diam The diameter of the pizza (in inches); must be 6 or more.
   * @return The amount of crust (in square inches)
   *    (test cases omitted, to fit on one screen in class)
   */
  double crustArea( double diam ) {
    return this.pizzaArea(diam) - this.toppingArea(diam);
    }

  }

homeinfolabshwsexams
textbookjava.lang docsjava.util docsarchive


©2008, Ian Barland, Radford University
Last modified 2008.Sep.19 (Fri)
Please mail any suggestions
(incl. typos, broken links)
to iba�rlandrad�ford.edu
Powered by PLT Scheme