Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Anyone can help me with my code pleasee?

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Anyone can help me with my code pleasee?

    Alright so im supposed to make a java app that tells you where to stand on this "game". This "game" is determined by how many people are in a circle. The game proceeds by a person holding a sword, passing it to the left to another person, and he passes it again, and the guy who has the sword kills the guy to his right. I have to create a java app which determines where to stand. I have this so far and i have no idea what to do next


    import java.util.Scanner;

    public class thegame {
    public static void main(String args[])
    int total_peeps;

    int win_position;
    Scanner myInput = new Scanner(System.in);
    System.out.println("How many people are playing the game?");
    total_peeps = myInput.nextInt();
    win_position = 0;
    for(int n=1; n<=total_peeps; n++){
    if (win_position == 0) {
    /*im not sure about this part*/
    } else {
    total_peeps %= n/5;
    System.out.println("If there are " + total_peeps
    + " Twilight fans, stand " + win_position
    + " to the left of the one with the sword.");
    }

    }


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Anyone can help me with my code pleasee?

    How would you do this without a computer? How would you write the rules for where to stand in normal language, without code?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. help pleasee
    By YNWA in forum Object Oriented Programming
    Replies: 2
    Last Post: March 22nd, 2011, 09:39 PM

Tags for this Thread