Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6061883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:59:16+00:00 2026-05-23T08:59:16+00:00

I have the following segment of a java file: Integer x; Integer y; Face

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:59:17+00:00Added an answer on May 23, 2026 at 8:59 am
    switch (facing) {
      case North  : facing=rotateIt==Rotate.Clockwise?Face.East:Face.West; break;
      case West   : facing=rotateIt==Rotate.Clockwise?Face.North:Face.South; break;
      case East   : facing=rotateIt==Rotate.Clockwise?Face.South:Face.North; break;
      case South  : facing=rotateIt==Rotate.Clockwise?Face.West:Face.East; break;
    }
    

    I should get a large percent of your grade retroactively!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following text in a file 23456789 When I tried to replace the
I have a controller class as in the following code segment: @Controller public class
Say I have the following piece of java code ArrayList<Double> myList = new Double[100];
I have the following code segment: var run = 0; var obj = {'item1':0,'item2':5,'item3':10};
If I have the following XML segment: <Times> <Time>1/1/1900 12:00 AM</Time> <Time>1/1/1900 6:00 AM</Time>
I have two identical byte arrays in the following segment of code: /// <summary>
I have the following json file: { segments: { externalId: 123, name: Tomas Zulberti,
I have the following segment of code where m_edit is a CEdit control: TCHAR
I have the following buildr buildfile segment: require buildr/protobuf .... define protobuf-stuff do pbs
For the following segment of java code, the method of run occurs four times.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.