Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions