Question: C + + we are going to implement a part of a variant of the famous Josephus problem. Your goal is to travel to as

C++we are going to implement a part of a variant of the famous Josephus problem.
Your goal is to travel to as many different destinations with your friends. The problem is that you can only travel to one destination on any given trip.
You are also required to have two other concrete classes, which have similar
designs that contain (has-a relationship) STL C++ classes. These classes must be called
ListMyJosephusand VectorMyJosephus. The class declarations for each must be placed in separate files, as
should the function definitions. You must name the files ListMyJosephus.h, VectorMyJosephus.h,
ListMyJosephus.cpp, and VectorMyJosephus.cpp. These classes will both contain at least the following public
member functions:
a. constructor accepts inputs to set the Mand Nmembers described below
b. destructor
c. clear () makes the sequence empty.
d. currentSize() returns the number of destinations still left
e. isEmpty() returns true if there are no destinations in the sequence
f. eliminateDestination() eliminates the destination based on the simulation rules and returns a copy
of the destination object eliminated
g. printAllDestinations() prints all of the destination cities left in the sequence, starting from the
destination with the smallest position/ID
You may need more methods to help with populating the container. Feel free to add as many
additional methods as you need. But the above methods are mandatory.
These classes must also contain at least the following private data members:
\deg M(an integer) the interval of elimination
\deg N ((an integer) the number of destination cities at the start of the simulation
\deg STL C++ container (std::listor std::vector)
The class ListMyJosephus must contain a std::list and class VectorMyJosephus must contain a
std::vector.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!