Help with Java programm pls!
Hello! I'm from greece and I'm new to using java. I have the following project to deliver tomorrow and I need some help if anyone can help me pls... The project is the following:
We are in the middle ages and we have a round table and M knights (1,2,3,4,...,m). Each time we have to send one knight to a mission. We need to pick one randomly, so we pick a random number k and start counting from knight 1 till we reach knight k. Thid knight k is excluded from the mission. Then we keep counting starting from the next knight (k+1) and we count till k again and the next knight we find is excluded again. If we reach the final knight (knight m) we start over again and we keep excluding knights till we remain with one, which is the knight to execute the mission. For example:
If M=5 and k=2
1,2,3,4,5 -> knight 2 is excluded -> 1,3,4,5 -> knight 4 is excluded -> 1,3,5 -> knight 1 is excluded -> 3,5 -> knight 5 is excluded -> knight 3 should execute the mission!
So we need a function S(m,k) which will return the remaining knight given the numbers m,k. I should write now a java program that fills and returns a 2d table A[m,k]=S20x20 where A[m,k]=S(m,k).
I have to use classes, programm flow check structures and methods on the functions for each calculation and action. Also I have to put in comments at the start of each class which explains what each class is doing...
Practically the program will just give out a 20x20 table.
I know this is an easy thing to do, but I can;t do it cause I don;t have any experience with java. If anyone could help I would be grateful. My e-mail and msn is email@example.com
Thanks a lot for your time....
|All times are GMT +5.5. The time now is 09:25.|