• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to start to write this team scheduling program in Java  RSS feed

 
Simon Cheng
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I would like someone to give me some ideas how to to write this program in Java. I don't want people to write the coding for me, but how to start and what method and should be used to get this program done. It's because I'm new in Java and want to use this as programming practice.

My idea program is a simple team scheduling program which allow users to enter numerous team and generate the schedule for each team. In the schedule, each team will play against each other once only.

e.g. 4 teams

Team 1 vs Team 2
Team 3 vs Team 4
----------------------
Team 1 vs Team 3
Team 2 vs Team 4
----------------------
Team 1 vs Team 4
Team 2 vs Team 3


My question is should I use Array to store all the teams? How do I generate the schedule, use Random class? How can I make sure that each team will play against each other once, and not duplicate it?

Thanks a lot.


 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Simon - welcome to Java Ranch!!

 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends what exactly you need to output. Do teams need names? Do matches have to have dates? If so, you could create a Team and Match classes which can contain all the required data.

If, on the other hand, all you need to do is to be able to enter an integer number that will generate a simple list like you show, it will be easier just to write a simple C-like method using integers to identify teams.

I would only use a random number generator if I wanted matches to be made randomly. It's up to you to decide if this is what you want. If not, do it systematically, i.e. match team 1 against teams 2 to n, then team 2 against teams 3 to n, then team 3 against teams 4 to n etc, and you will cover all possibilities. The way to make this totally fair in the real world is to randomize which team is identified as team 1, 2 etc.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!