Question: How do I change the parameters in question while in Java? public class Enemy { int x , y , z ; , ? ?

How do I change the parameters in question while in Java?
public class Enemy {
int x,y,z;,??3 global variables
// variables above, methods below
Enemy (){
x=0;,y=0;,z=0;
}
Enemy ( int newx, int newy, int newz) constructor 2
x= newx; ,y= newy; z= newz;
}
void moveposition ( int xdif, int ydif, int zdif){// method
x=x+ xdif ;,y=y+ ydif ;,z=z+ zdif;
System.out.println(" Enemy moves to x:+x+y:+y+z:+z;
}
}??? end of class Enemy
Write one line of code to declare a reference variable named: the_enemy
(Declare only, do not CREATE the object)
(1) correct
Write one line of code to declare a reference variable named: a_enemy
AND create the object using the default constructor
(2) correct
Write one line of code to declare a reference variable named: enemyobject
AND create an object using the constructor with 3 parameters
all 3 values for the parameters should be 514
(3) INCORRECT
Write one line of code to move the object using the variable: enemyobject
On the x axis move 3, on the Y axis move -3, on the Z axis move -1
(4) INCORRECT
 How do I change the parameters in question while in Java?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To correct the errors in parts 3 and 4 lets provide ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!