Free Version
Moderate

# Documenting a Method by Using Comments

APCSA-GFXEPF

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 would be BEST for documenting this method?

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
*/
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
*/
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