A class is designed with two public attributes: attributeOne and attributeTwo. attributeOne is an integer data type while attributeTwo is a string data type. Which pseudocode representation(s) of setters would be appropriate for this class? (Points : 5) A. int setAttributeOne(int newAttributeOne)
{
return attributeOne
}
B. void setAttributeOne(int newAttributeOne)
{
attributeOne = newAttributeOne
}
C. string setAttributeTwo (int newAttributeTwo)
{
attributeTwo = newAttributeTwo
}
D. void setAttributeTwo ()
{
attributeTwo =

Answer :

Answer:

B. void setAttributeOne(int newAttributeOne)

{

attributeOne = newAttributeOne

}

Explanation:

The class has two public attributes : int attributeOne and String attributeTwo.

The appropriate setters for these attributes will be as follows:

void setAttributeOne(int newAttributeOne)

{

attributeOne = newAttributeOne ;

}

void setAttributeTwo(int newAttributeTwo)

{

attributeTwo = newAttributeTwo;

}

The highlighted code corresponds to option B among the given options. So option B is the correct setter for attributeOne.

Other Questions