473,378 Members | 1,156 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Database SQL high school: Soccer round robin?

Hi everyone! this should be pretty simple for programmers on this forum... I need to design a java program which interacts with a MS Access DB in order to simulate the progression of a soccer round robin (e.g. FA Cup). i.e. Select 2 teams (out of 16 teams) randomly to play each other & determine the winner, who therefore plays the winner of one of the other matches etc. until the final winner is determined. I've created a database (SoccerChallenge) with the following tables: Teams, Round 1 results, Quarter-final results, Semi-final results & Final results. I've already succesfully connected the DB with Administrative tools and displayed the "Teams" table. All I need help with is to:
1)Randomly select 2 teams from the "Teams" table to play each other - without selecting a team more than once of course.
2)Determine winner and place them into the next round - I think I have to use something similar to this:
Expand|Select|Wrap|Line Numbers
  1. if (goals1 > goals2) { winners[0] = team1;
NB: I have to do this using JFrame or JOptionPane, no applets preferably. Feel free to suggest any structural changes I should make to my database to make it work as well please. Any bit of help will be very very, very appreciated guys!! Thanks a mil!!
May 25 '08 #1
5 2170
JosAH
11,448 Expert 8TB
Don't use those silly arrays: use a List instead and have a look at the very handy
Collections.shuffle() method.

kind regards,

Jos
May 25 '08 #2
Don't use those silly arrays: use a List instead and have a look at the very handy
Collections.shuffle() method.

kind regards,

Jos
Thank you so much for responding to my thread firstly, I really do appreciate it. I looked up the collections.shuffle() method and it seems to be the solution. Can you please elaborate on exactly how I'd use it? Thanks again!
May 25 '08 #3
JosAH
11,448 Expert 8TB
Thank you so much for responding to my thread firstly, I really do appreciate it. I looked up the collections.shuffle() method and it seems to be the solution. Can you please elaborate on exactly how I'd use it? Thanks again!
Simply fill a list with all your teams; shuffle it and make eight matches out of
the sixteen teams. Record the winners. Fill a list with the winners; shuffle it and
build four matches out of the eight teams. Record the winners, etc. etc.

kind regards,

Jos
May 25 '08 #4
Simply fill a list with all your teams; shuffle it and make eight matches out of
the sixteen teams. Record the winners. Fill a list with the winners; shuffle it and
build four matches out of the eight teams. Record the winners, etc. etc.

kind regards,

Jos
Excellent! I'll get right to it tomorrow at school and let you know if I have any problems. Thanks a mil.
May 25 '08 #5
BigDaddyLH
1,216 Expert 1GB
I'm guessing you'll want a tutorial on collections: http://java.sun.com/docs/books/tutor...ons/index.html
May 26 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

75
by: Howard Nease | last post by:
Hello, everyone. I would appreciate any advice that someone could give me on my future career path. Here is my situation: I am a bright Junior in a very well-respected private high school, taking...
4
by: Sam | last post by:
Hello everyone, I have around 20 reports in an ASP web-application which connects to a SQL Server 2000 dB, executes stored procedures based on input parameters and returns the data in a nice...
1
by: Jerry Khoo | last post by:
i am currently working c++ project about executing a round robin algorrithm, how do i control when the algorithm should stop, what is the condition for the loop to stop, what is the condition to...
16
by: msnews.microsoft.com | last post by:
I am teaching C# to my 11 year old child. One challenge is that all the C# books I own and that I have seen in bookstores are full of language that is not easily comprehended by a student at that...
1
by: Scott | last post by:
Hi All. I have a web site that is currently using DNS round robin as a poor man's load balancer. Some users are receiving an 'Unable to Validate Data' error when posting back to the server. ...
1
by: hanumanthu | last post by:
The Hatfield High school database has been extended and contains confidential information about both students and staff. When we come to create a distributed database, this would potentially reveal...
6
by: rhitx | last post by:
Can somebody please give like an overview how to do a round robin scheduler.. I know that we're suppose to use a quantum/quanta? Is this going to be like an int, then assign with with a value? ...
2
by: =?Utf-8?B?aGVyYmVydA==?= | last post by:
how do I code generic functions to return the next item in an enumeration a) sorted by name, b) sorted by value c) sorted by declaration in a round-robin style ? for example the enum is Enum...
8
by: 08butoryr | last post by:
Hey guys I could really use your help with some very basic java programming. I know you programming fundis out there will find this child's play but I'm struggling with it a bit because I'm...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.