Limited access

Upgrade to access all content for this subject

Consider the following method in a Tractor class.

public int calcWeight(int body, int scraper, int roof)
{
     int weight = body + scraper + roof;
     return weight;
}

Which of the following techniques for documenting this method would provide the most information, and also give easy access to this documentation anywhere this method is called in the code?

A
/*
* Calculates the weight of tractor by adding
* weights of all the features and modifications
*/
public int calcWeight(int body, int scraper, int roof)
{
     int weight = body + scraper + roof;
     return weight;
}
B
// Calculates the weight of tractor by adding
// weights of all the features and modifications
public int calcWeight(int body, int scraper, int roof)
{
     int weight = body + scraper + roof;
     return weight;
}
C
/**
 * Calculates the weight of tractor by adding
 * weights of all the features and modifications
 *
 * @param body weight of tractor's main body
 * @param scraper weight of scraper attachment
 * @param roof weight of optional roof
 * @return total weight of the tractor and attachments
 */
public int calcWeight(int body, int scraper, int roof)
{
     int weight = body + scraper + roof;
     return weight;
}
D
/*
 * Calculates the weight of tractor by adding
 * weights of all the features and modifications
 *
 * @param body weight of tractor's main body
 * @param scraper weight of scraper attachment
 * @param roof weight of optional roof
 * @return total weight of the tractor and attachments
 */
public int calcWeight(int body, int scraper, int roof)
{
     int weight = body + scraper + roof;
     return weight;
}
E
/**
 * Calculates the weight of tractor by adding
 * weights of all the features and modifications
 *
 * @param body weight of tractor's main body
 * @param scraper weight of scraper attachment
 * @param roof weight of optional roof
 * @return total weight of the tractor and attachments
 *
public int calcWeight(int body, int scraper, int roof)
{
     int weight = body + scraper + roof;
     return weight;
}  
*/
Select an assignment template