I have the following segment of a java file:
Integer x; Integer y; Face facing;
enum Rotate { Clockwise, Anticlockwise };
enum Face { East, North, West, South };
and am having trouble figuring out how to implement a function to change the Face of an object (i.e. the direction that the object is facing).
The function begins as follows
private void rotateIt(Rotate rotateIt) {
{
I have begun using the switch statement as follows ( below text is inside braces above ):
switch (facing)
case North : ...?;
case West : ...?;
case East : ...?;
case South : ...?;
I’d like to use the Clockwise enumeration to turn it from East to South etc. and Anticlockwise to do the reverse IYGWIM.
I should get a large percent of your grade retroactively!