CS401 | sw engineering
  • outline
  • projects
  • syllabus
  • links
d

Commenting Code and Writing Styles --****see later Google Coding Styles****

You need to follow the following guidelines about commenting:
  1. As we are doing Java you should have only ONE class inside each java file
  2. Always have class Comments contained, the Author, date of creation, updates, Purpose, and how to class (if appropriate). See example below
  3. Before each class, put comments that tell the user the pupose of the class.
  4. Before each method inside of a class, put comments on what it does and how to call it.
  5. Comment inside each method and at variable declarations as appropriate so that users can understand what the code is doing with ease.
  6. Don't overcomment or undercomment, use common sense.
  7. Use indention rules to make your code easy to read.

/**The Car class represents a generic Car
  contains variables about Engine_Size, Gas_Tank
@author Lynne Grewe
@since Sept. 22, 2024
@version 1.2

**/
class Car {

   /**
    * Engine_Size represented by a float that gives size of the engine in Litres (1,000 cubic centemeter 
    *   indicates 1.0 litre air-fuel mixture)
   */
   float egineSize;


    /** Gast taknk size as a float number representing the number of gallons to fill tank
    */
    float gasTank;


    /**
    * Sets gasTankto num_gallons
    * @param num_gallons the number of gallons to set  to gas_tank
    * @returns nothing
   */
    void fill_Tank(float  num_gallons) {
       gasTank = numGallons;
    }


   /**Allows user to specify new Engine Size
   * @param size  the new size of the engin in litres
   * @returns nothing
   */
   void changeEngine(float size) {
       
	    engineSize = size;
   }




}


              

cs401:sw engieering

  • home
  • outline
  • projects
  • syllabus
  • links