Question: can you make the program in c++ and .h in public and private Create a program that uses a circular linked list to solve the


Create a program that uses a circular linked list to solve the "Josephus Game". The Josephus game is an elimination method where the selection mechanism iterates through the positions at a set interval and sequentially removes positions until only one remains (see example output). i. First prompt the user for the number of positions followed by the elimination interval. ii. Determine the final position and print it to the console. ii. During the simulation, print out the positions in the order of elimination and print the remaining positions (again, see example output). iv. Start numbering your positions from one and note that you may have to adjust the interval to account for the position you start on. Remember to release memory as nodes are removed. Your work for this lab should be done in the directory -ICMPT276/Lab3 When you have completed your work, demonstrate it to the instructor and upload your solution to Moodle in a single zip file. Submitting Your Work Submit your entire Lab3 directory as a .tar.gz archive, online through Moodle. You can do this with these commands: > cd /CMPT276 > tar cvzf LASTNAME.tar.gz Lab3 Double check that you have the right file before you submit. Uploading the wrong file will result in a mark of ZERO for the entire assignment. Program Specification: Additional Program Specification You have the following files circular_list.h, circular_list.cpp, node.h, node.cpp, and main.cpp Use suitable information encapsulation techniques (i.e. data members should be private and a function not changing the object should be constant). All files (.h and.cpp) should include a comment at the top of the file, with your name, and a brief description of what the file is for. All functions should be properly documented in the header file, including PRECONDITIONS and POSTCONDITIONS (with those words). You do not need to include this in the function implementation as well. Your code should include appropriate comments, identifying variables (if needed) and describing what each section of code is doing. All identifiers (function and variable names) should be meaningful. Your code should have proper indentation and spacing. (Ask me if you are not sure.) Make your functions minimal -- do not pass in variables that you do not need. Any objects to be passed as parameters should be passed by reference. Make sure to declare object inputs as const where appropriate. Functions which do not modify the object should be const. Sample Output from main: Please enter number of spaces: Please enter number of spaces: 7 Please enter spaces per elimination: um of spaces Spaces per elitia Printing list. 2 3 4 5 6 lite 2 Printing list: 3->8>5-> 671 intet Printing 1st $ -> 6 - 7 -> -> 3 11 ninate 6 Printing list -> 1-3.5 Eliminate 1 Printing list 57 Flintes Printing list 7 -> 3 Printing list: the last position to be eliminated 183 Press any way to continue If you are confused, feel free to come to the lab for questions/ clarifications Grading circular list class 30% node class 20% main.cpp 30% documentation & formatting Warning: If you write a function for your class, but your test program does not demonstrate this function or fully exercise its code, you will not get full credit for your code, even if it works correctly. *** NOTE: Your code must compile and execute within the laboratory environment. Code that does not compile will result in a mark of ZERO for the entire assignment. *** 20% Please enter number of spaces: Please enter number of spaces: 7 Please enter spaces per elimination: Assignmentssolution Please enter number of spaces: 7 Please enter spaces per elimination: 2 Printing list: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 Eliminate 2 Printing list: 3 -> 4 -> 5 -> 6 -> 7 -> 1 Eliminate 4 Printing list: 5 -> 6 -> 7 -> 1 -> 3 Eliminate 6 Printing list: 7 -> 1 -> 3 -> 5 Eliminate 1 Printing list: 3 -> 5 -> 7 Eliminate 5 Printing list: 7 -> 3 Eliminate 3 Printing list: 7 The last position to be eliminated is: 7 Press any key to continue If you are confused, feel free to come to the lab for questions Grading
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
