Question: In Java, write an application that will simulate the Josephus scenario. The user will be allowed to enter values for the starting index for the
In Java, write an application that will simulate the Josephus scenario. The user will be allowed
to enter values for the starting index for the counting, the number of people to skip before killing
and the number of people in the circle.
You will use a boolean array to represent the circle of people
True elements of the array represent a living person, false elements are dead people.
When counting upward toward the target number to kill a person, you will not count false
elements. You will only count living people.
When the simulation ends, the program should output the safe spot to stand. That is the
last index that is true in the array after the rest were set to false.
How you implement this problem is up to you but I require that you use loops for array
traversal.
You must also use File IO
The program must write to a file.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
