##### Reference no: EM131060312

Table Flipping

Directions: There are 2000 tables set up for the College job fair. All tables are upright. 2000 students arrive to the fair, each one with their ID number, looking to cause chaos. The student with ID 1 ?ips all 2000 tables. The students with ID 2 then rights all tables whose numbers are multiples of 2. The student with ID number 3 changes the status of all tables whose numbers are multiples of 3 (e.g. table number 3, which is ?ipped gets righted, table number 6, which is upright, gets ?ipped.) The student with ID number 4 changes the status of all tables whose numbers are multiples of 4, and so on for all 2000 students.

Use arrays, no crashes. When you run the simulation, it should simulate all 2000 students turn flipping tables. You can design your own user interface for this homework any way you'd like.

Aside from the user running the simulation, your user interface should be able to run queries to assist in answering the following questions (or any similar question):

Your task is to find:

1. Is table 1337 ?ipped or upright?

2. Which tables will be left upright at the end?

i. If you had to list off the ?rst 5-10 table that were left upright, without your program for help, could you? Is there a rule?

3. Which table was ?ipped the most times?

i. How did you store the data for this homework? Think about how you store the information helps you to answer the question.

4. How many tables, and which ones, were ?ipped exactly twice?

5. How many of the even numbered tables are upright? How many odd numbered tables?

Some of the tables are ?magic tables. Each time table 1999 and 3501 are touched, add 1000 tables. The old tables keep their states and the new tables start off upright. Do not reset the current operating student number. Aka when student #9 touches table 702, he should continue with table 711 after the new table are made (then #10 goes after).