} 4 Create an Orc class that extends Monster. It should have the following PUBLI
ID: 3714851 • Letter: #
Question
}
4 Create an Orc class that extends Monster. It should have the following PUBLIC methods: No-arg constructor (does nothing) Constructor that takes x, y, and health (calls super constructor from Monster Concrete implementation of Drawable method: voiod drawToMap(Map screen) If screen is nu, return. Otherwise, draw 'o' at (x,y) of 5 Create an Spider class that extends Monster It should have the following PUBLIC methods: No-arg constructor (does nothing) Page 3 of 9 Constructor that takes x, y, and health (calls super constructor from Monster) Concrete implementation of Drawable method: void drawToMap(Map screen) If screen is screen return. Otherwise, draw 's' at (x,y) ofExplanation / Answer
Code:
class ORC extends Monster{
// Default constructor
public ORC(){
}
// Parametrized constructor
public ORC(int x, int y, int health){
super(x,y,health);
}
public void drawToMap(Map screen){
if(screen == null){
return;
}
else{
// Add code to draw 'o' at x and y location
}
}
}
class Spider extends Monster{
// Default constructor
public Spider(){
}
// Parametrized constructor
public Spider(int x, int y, int health){
super(x,y,health);
}
public void drawToMap(Map screen){
if(screen == null){
return;
}
else{
// Add code to draw 's' at x and y location
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.