< previous page page_1117 next page >

Page 1117
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Write a program to read in the entries from friendFile and store them into a dynamic linked list ordered by birth date. The output should consist of a listing by month of the names and telephone numbers of the people who have birthdays each month.
3. In Chapter 17, the Personnel Records case study reads a file of personnel records, sorts the records alphabetically, and prints out the sorted records. Rewrite the program so that it reads each record and stores it into its proper position in an ordered list. Implement the ordered list as a dynamic linked list using this chapter's OrdList class as a model. Note that the limit of 1000 employee records is no longer relevant because you are using a dynamic data structure.
4. This chapter's OrdList class implements an ordered list ADT by using a linked list. In turn, the linked list is implemented by using dynamic data and pointers. Reimplement the linked list using an array of structs. You will have to manage a free store within the arraythe collection of currently unused array elements. To mimic the new and delete operations, your implementation will need two auxiliary functions that obtain and release space on the free store.
Case Study Follow-Up
1. The CardDeck class is derived from the CardPile class using inheritance.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
a. List the names of all the public members of the CardDeck class.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
b. List the names of all the private members of the CardDeck class.
2. In the Shuffle function of the CardDeck class, why are the declarations of halfA and halfB located inside the body of the For loop? What would happen if the declarations were placed outside the loop at the top of the function?
3. Give the Player class more responsibility by making it prompt for and input the number of shuffles and the random number seed. Encapsulate the numberOfShuffles and seed variables within the Player class, and add two member functions named GetNumShuffles and GetSeed. Show the new class declaration and the implementations of the two new functions. Also, rewrite the main function, given these changes.

 
< previous page page_1117 next page >