Create an account to track your scores
and create your own practice tests:
Test: AP Computer Science A
1. | Design a class, SuperHero, that will be used for an existing application. The class should extend the parent class Man. The class should define clothes, skin color, hair color, eye color, good or evil, whether or not powers are had, and a list of personality traits. The class Man supports an implementation of the method doGood. Here is the method stub for doGood:
Your class will need to support an implementation of doGood. Choose the best answer. |
class SuperHero extends Man {
List clothes;
String skinColor;
String hairColor;
String eyeColor;
Boolean good;
Boolean powers;
List personalityTraits;
public String doGood(Boolean good) {
}
}
class SuperHero extends Man {
List clothes;
String skinColor;
String hairColor;
String eyeColor;
Boolean good;
Boolean powers;
List personalityTraits;
public String doGood(Boolean good) {
String result = "No, do bad!";
if (good == true) {
result = "Yes, do good!";
}
return result;
}
}
class SuperHero extends Man {
List clothes;
String skinColor;
String hairColor;
String eyeColor;
public String doGood(Boolean good) {
String result = "No, do bad!";
if (good == true) {
result = "Yes, do good!";
}
return result;
}
}
class SuperHero {
List clothes;
String skinColor;
String hairColor;
String eyeColor;
Boolean good;
Boolean powers;
List personalityTraits;
public String doGood(Boolean good) {
String result = "No, do bad!";
if (good == true) {
result = "Yes, do good!";
}
return result;
}
}
