2 Replies Latest reply: Jan 3, 2013 6:00 PM by 970521 RSS

    Perfecting a graphical program that randomly picks a seat for each student

      I have created a program that randomly picks a seat for each student. We are 26 and every other week we use the program to select seats for us.
      The program is fully functional but there is one last thing I'd like it to do.

      Follow along, get all the required resources for the program here (42 Kb): https://dl.dropbox.com/u/32876027/ekki_eyda/Oracle_forum/Seating/Seating.zip
      You should get "Seating_v2.java" which is the actual program's source code, "StdDraw.java", both .class files (compiled in Windows) and the folder "Pictures".
      If you don't have a java editor handy and just want to read the code, rename "Seating_v2.java" to ""Seating_v2.txt"

      The pictures folder originally held a picture for each of the 26 students but for privacy reasons I have replaced the actual pictures with the alphabet, A-Z. (Thankfully, the alphabet holds 26 characters)

      https://dl.dropbox.com/u/32876027/ekki_eyda/Oracle_forum/Seating/Example.JPG Here's a picture of how the program behaves. In this example, we see that the program has told student P to sit at the seat numbered 1. Furthermore, Q is to sit at seat number 16.

      Let's say the program is run on the 7th of January. These will be the results: https://dl.dropbox.com/u/32876027/ekki_eyda/Oracle_forum/Seating/Example.JPG
      On the next run of the program, 2 weeks later on the 21st of January, how can I make the program let no one sit on the same row as they did the 2 weeks before?
      For example, the program would make sure that since P sat on row 1, this time P would only be able to sit on rows 2, 3 or 4. Also, since Q sat on row 3, this time Q would sit on rows 1, 2 or 4.

      Any tips appreciated.

      Edited by: 967518 on Jan 2, 2013 8:05 AM

      Edited by: 967518 on Jan 2, 2013 8:07 AM

      Edited by: 967518 on Jan 2, 2013 8:07 AM

      Edited by: 967518 on Jan 2, 2013 8:11 AM