Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Program a Jewish historian living in the 1st century named Flavius Josephus gave an account of the siege of Yodfat, where he and his

Java Program

a Jewish historian living in the 1st century named Flavius Josephus gave an account of the siege of Yodfat, where he and his 40 soldiers were trapped in a cave by Roman soldiers. Choosing suicide over capture, they settled on a serial method of committing suicide where each person to die would be killed by the next person to die. Josephus states that by luck or possibly the hand of God, he and another man remained until the end and surrendered to the Romans rather than killing themselves.

The precise mechanism for choosing the order of the executions was not completely described in Josephus' account, however in 1612 Claude Gaspar Bachet (the writer of books on mathematical puzzles and tricks that formed the basis for almost all later books on mathematical recreations) suggested that the men arranged themselves in a circle, and then started counting by threes from a randomly selected man.

Using array as the queue implementation, write a programthat prompts the user for a number of people in a circle, and a valuen, where everynthperson will be killed, and then finds) and displays the positions of those people killed, in the order they died. Repeat the process until answer given is N. Show error message for invalid answer.

image text in transcribed
\f

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions