The instructions to answer my question are below in bulletpoints, and write the
ID: 3924121 • Letter: T
Question
The instructions to answer my question are below in bulletpoints, and write the code in Java. And please please please, DO NOT write classes or declare variables.
Exercise 6.2: Inheritance and Objects Create an object from the child class and assign to a variable named theenemy Call the 'se method of the parent class and pass it the value 437 Call the 'set' method of the child class and pass it the value 5 . Call the 'get method of the parent class and assign the return value to a variable named current · You do not have to write classes or declare variables, I will do that. Just create an object instance and call the methods. public class Enemy public class PitBull extends Enemy public class PitBull extends Enemy { private int attackmode; private int xposition, yposition; public void set_xposition(int x)f public void set_attackmode (int am) ( et-position (int x){ xpositionx; ; attackmode = am; public int get_xposition public int get_attackmode return attackmode; return xposition;Explanation / Answer
a) PitBull theenemy=new PitBull();
b) theenemy.set_xposition(437);
c) theenemy.set_attackmode(5);
d) int current=theenemy.get_xposition();
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.