CSE 2010: Asgn #6, Josephus using ArrayList

Due: Monday, 8 June 2009 (midnight)

The Task

We have n people in a circle. Assume that the people are numbered ("named") 1 through n. Eventually we select all the people in the circle one-by-one. We are given an interval to skip. So for the interval i=3, the first few people selected are 3, 6, 9, etc. The task is to find the number of the last person selected.

Input/Output

The input to the program comes only from the command line. The first command-line argument is the interval. The second command-line argument is the number of people. The output is one whole number.

For example, the command line

java Josephus 2 9
yields 3; and
java Josephus 3 107
yields 7.

Helpful Stuff

Turning it in

Turn in the Java source code for the program using the submission server. The file name should be Josephus.java and the project is asgn06. Be sure your name is in comments at the beginning of your program as required in the standard header for this class. For your convenience, here is a submission form for this assignment.

File 1
Control code:
Course=cse2010
Project=asgn06


Ryan Stansifer <ryan@cs.fit.edu>
Last modified: Mon Jun 8 14:16:45 EDT 2009