.ZIP

Programming Test – Number Ring

This is an individual test and you are required to work on this test alone. No cheating and no searching online.

Specification:

1. Please create a project folder (using any programming language) with the following name:

2. In the above project you can implement in any programming language to realize the following functions.

3. Your program will access an input file with the name “COSC489_PT_2168_Input.txt”, which is located right outside of the above project folder (i.e. your project folder and this input file are sitting in the same folder). Please make sure in your program don’t use absolute path but a relative path to access the input file. A sample of this input file is provided together with this specification.

4. Your program will process the above input file and operate as it specifies.

5. Initialize a number ring: read in the initial list of number and create the initial number ring with the first number to be the current number on the ring (the red number is the current number). Given the initial list of numbers of 2 3 5 6 1 4 8 5 we can get.

5

3

6

2

1

4

5

8

6. The following list of operations can be carried out in any order and repeated any number of times. The operation names are case insensitive.

7. Insert: it will add a number into the ring right before (counterclockwise) the current number. The newly inserted number will become the new current number.

5

5

4

3

3

6

2

2

1

7

4

5

5

8

8

8. Append: it will add a number into the ring right after (clockwise) the current number. The newly appended number will become the new current number.

5

5

4

3

3
6

7

2

1

2

4

5

5

8

8

9. Delete: it will delete the current number. Its right hand side (clockwise) number will become the new current number.

5

4

6

3

5

6

1

2

3

1

4

5
5

8

8

10. Jump: it changes the current pointer. If the jump number is too large/small, the counting wraps around the ring again and again. Positive jump number means going clockwise while negative means counter-clockwise.

5

5

4

3

3

6

2

1

2

4

5

5

8

8

11. Sort: it will sort the numbers in the ring in increasing order clockwise. The current number will be in the same place after sorting.

5

4

4

3

3

5

6

2

2

1

5

5

1

6

8

8

12. Print: it will print out all the numbers in the ring in one line starting at the current number and going clockwise.

5

4

3

6

2

1

2 3 5 6 1 4 8 5

5

8

13. You are required to demonstrate your program to the instructor on the due day in class in order to receive grades.