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 5 of 5

Thread: AND THE WINNER OF THE BIRTHDAY COMPETITION IS...

  1. #1
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Thumbs up AND THE WINNER OF THE BIRTHDAY COMPETITION IS...

    And the winner of the Happy Birthday competition is...


    * Freaky Chris *


    2nd Place
    Splat

    3rd Place
    Dalisra

    A big thank you to everyone who took part in the competition and wished us a Happy Birthday!

    I will PM the winners shortly...



    The competition winners were selected using this Java application:

    import java.util.Random;
     
    public class CompetitionWinners {
     
        private static String[] contestants = { "leandro", "Freaky Chris",
                "pmural", "Pooja Deshpande", "chals", "mBrian", "kairamr",
                "loonatic", "btedford", "blackJava", "Jchang504", "xuming9",
                "clow2821", "mpoland", "bebooahlawy", "fourseven", "yogita281",
                "jega004", "Splat", "slaw77pl", "aks_java", "sriram", "Fendaril",
                "Dalisra", "dewboy3d", "luke", "Flash", "marksquall" };
     
        private static String firstPlace, secondPlace, thirdPlace;
        private static int randomInt;
        static Random random = new Random();
     
        public void First() {
     
            // GENERATE FIRST PLACE WINNER
            for (int a = 0; a < 3; a++) {
                randomInt = random.nextInt(28);
            }
            firstPlace = contestants[randomInt];
            Second();
        }
     
        public void Second() {
     
            // GENERATE SECOND PLACE WINNER
            for (int a = 0; a < 3; a++) {
                randomInt = random.nextInt(28);
            }
            secondPlace = contestants[randomInt];        
            if (secondPlace.equals(firstPlace)) {
                Second();
            }else{
                Third();
            }
        }
     
        public void Third() {
     
            // GENERATE THIRD PLACE WINNER
            for (int a = 0; a < 3; a++) {
                randomInt = random.nextInt(28);
            }        
            thirdPlace = contestants[randomInt];        
            if (thirdPlace.equals(secondPlace) | thirdPlace.equals(firstPlace)) {
                Third();
            }else{
            }
        }
     
        public void GenerateWinners() {
            First();
        }
     
        public static void main(String[] args) {
     
            CompetitionWinners cw = new CompetitionWinners();        
            cw.GenerateWinners();
     
            System.out.println("1st Place : " + firstPlace);
            System.out.println("2nd Place : " + secondPlace);
            System.out.println("3rd Place : " + thirdPlace);
            System.out.println();
            System.out.println("All winners selected");
        }
    }
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.


  2. #2
    Junior Member
    Join Date
    Nov 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: AND THE WINNER OF THE BIRTHDAY COMPETITION IS...

    Congratulation Freaky Chris, Splat and Dalisra.

  3. #3
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Posts
    834
    My Mood
    Cynical
    Thanks
    7
    Thanked 105 Times in 90 Posts

    Default Re: AND THE WINNER OF THE BIRTHDAY COMPETITION IS...

    Thank you

    Congrats guys

  4. #4
    Junior Member Splat's Avatar
    Join Date
    Feb 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face Re: AND THE WINNER OF THE BIRTHDAY COMPETITION IS...

    Whoooo! Congratulations Chris.

    I wanted to win the tshirt!!!

    Thanks JavaPF.

  5. #5
    Little Star
    Join Date
    May 2009
    Posts
    30
    Thanks
    0
    Thanked 9 Times in 7 Posts

    Default Re: AND THE WINNER OF THE BIRTHDAY COMPETITION IS...

    Weee! Thanks a lot! Wasn't expecting to win at all.

Similar Threads

  1. HAPPY BIRTHDAY JAVA PROGRAMMING FORUMS!
    By JavaPF in forum The Cafe
    Replies: 30
    Last Post: June 4th, 2009, 08:32 AM

Tags for this Thread