Task 1: Simulate a game of Musical Chairs
1. Implement Programming Project #11-Chapter 14 (Savitch), pp. 666/667. Implement the classes and member functions as stated in the problem. Place all classes into one file. Output should be user friendly.
Name the program: PlayCardInheritXX.cpp, where XX are your initials.
2. In the childhood game of Musical Chairs, chairs are placed in a circle with one less chair than players. Children march to the music around the circle of chairs until the music stops. Then each child sits in the chair nearest them. The one child that cannot find a chair is eliminated from the game. A chair is removed and the game continues until there is just one person left. That person is the winner. Write a C++ program to simulate a game of Musical Chairs and determine the winner of each game played. The simulation will work as follows:
• The chairs are numbered from 1 to m.
• The children are numbered from 1 to m + 1.
• Two integers a and b are given. The first integer a is the chair number where child #1 will sit when the music stops. When the music stops, the children begin sitting down with child #1 sitting in chair a, child #2 sitting in chair a + 1, etc, until chair b is reached. The person who would have been assigned to chair b is eliminated and the next person in line is seated in chair b.
• Since the chairs are in a circle, once chair m is reached, the children begin sitting in chair #1 and continue until the rest of the children have been seated.
• The children are then renumbered with the child sitting in chair #1 becoming child #1, the child in chair #2 becoming child #2, etc.
• Chair number m is then removed and the game is continued with one less chair and one less child.
Input: The first line from a text file, will contain a single integer n that indicates the number of games to be played. For each game there will be m + 2 lines where m is the number of chairs in the game. The first of these lines will be the integer m that indicates the number of chairs in the game. The second of these lines will have the first names of m + 1 players separated by a comma and a space. Each of the next m lines will have two integers separated by a space. The first integer a will represent the chair number where the children will begin sitting and the second number b will be the number, relative to the first chair, of the person who will not find a seat. Output: For each game, label the game played, on the following line output original players of the game, output a blank line, then output the order of the students, beginning with chair #1, each time the music stops. The winner will be the last child. Output a blank line between each game played. Let the user input the file name from the keyboard. Refer to the sample output below.
Telephone numbers in the US and Canada are organized into various three-digit area codes. A single area code will not cross a state or provincial boundary. This rule makes it possible to list the geographical locations of each area code in a data file. Write a C++ program that reads the file into a STL Map where the key is the area code and the value is the location. The user can either enter an area code or state/providence from the keyboard and have the program list all the area codes (or state) that serve that area. Text file will be provided by the instructor. Let the user enter the file name from the keyboard. The program will repeatedly run until the user enters "QUIT". Check for case. Use the STL classes. Refer to the sample output below.