Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions