Yorkville High School Computer Science Department
Yorkville High School Computer Science Department on Facebook  Yorkville High School Computer Science Department Twitter Feed  Yorkville High School Computer Science Department on Instagram

Yorkville High School Computer Science

ASSIGNMENTS: APCS Multiple Choice Part 1 - December 13, 2017 :: APCS Multiple Choice Part 2 - December 14, 2017

AP Computer Science :: Projects :: Josephus

Rubric
Lesson
Due: Oct 17

Problem

There are different versions of the story of Josephus, but the one we will focus on entails Josephus trapped in a cave during the first century with a number of his fellow soldiers. It was considered a sin to commit suicide so, rurrounded by the Romans, the soldiers decided to stand in a circle and every third man would be killed by his fellow soldiers until one remained, who would then have to kill himself. Josephus, either by luck or the hand of God, remained alive at the end and decided to surrender to the Romans. Your task is to create a program that will model the Josephus problem and determine the correct place to stand in the circle given the number of people and the increment.

View an Example

Instructions

  1. Download this project to start.
  2. You must use an ArrayList to store the number of each person standing in the circle. The numbers should start at 1.
  3. A constructor should add everyone to the list given the number of people in the circle.
  4. Create a method that removes a given person from the list until only 1 remains. It should return the number of the person left at the end as a String.
  5. Create good unit tests that use good test data. You may want to calculate the Josephus problem on paper a few times to determine your unit tests or use the above example.

Tips

Yorkville High School Computer Science Department on Facebook Yorkville High School Computer Science Department Twitter Feed Yorkville High School Computer Science Department on Instagram