The director of Camp Posanivee is frustrated. Campers are enrolling and withdrawing from camp faster than her primitive filing system...
The director of Camp Posanivee is frustrated. Campers are enrolling and withdrawing from camp faster than her primitive filing system can handle, and she has turned to you. You have been offered free meals at the mess hall in return for a program that will help her keep track of who is enrolled for the two-week summer camp.
Your program will use a binary search tree to maintain the set of campers enrolled in Camp Posanivee. Your program should not be case-sensitive.
Your program will consist of a loop to process commands. The commands should come from a text file (say, "camp.txt"). The program quits when the command 'Q' is given. Below is a list of commands your program should support:
H Help: print a list of commands
E name age gender Enroll a new camper (insert)
W name Withdraw a camper (delete)
D name Display the age and gender of a camper
A Print the average age of the campers
L List all campers names in alphabetical order
S Print the number of boy and girl campers
P List all campers names in preorder
Q Quit
Here name is a string of at most 20 non-blank characters, age is an integer, and gender is either M or F. You may assume command arguments are separated by one or more spaces.
Be sure to echo the input, especially for commands that give no output (like E or W), and handle special cases in a clean way (for example, computing the average age of an empty tree should not crash your program).
13 years ago
5
Answer(0)
Bids(0)
other Questions(10)
- A 29-ft rope from the top of a flagpole reaches to the end of the end of the flagpole's 10-ft...
- Mr. Harshawardhan Nanawati ( Mr. H) of Mumbai won 70 lacs after the payment of tax from a money game...
- Linear Algebra Homework Matlab
- true or false Korea was separated by armed conflict following World War II and reunited after the Paris Peace Accords.
- a
- Search and Sell : In today's vitual environment, marketing a brand is even more competitive than ever, search engine marketing is necessary to help create brand awarness in the vitual market place. One concept known as Search Engine Marketing helps increa
- For IN_THE_MIDDLE_OF_THE_NIGHT ONLY*****
- For each sentence, tell which word is idefinite pronoun and which verb agrees with it. 1.everything outside (is,are) covered with snow. 2.several...
- Variation 1)If 1/3 kilogram of fish costs 35 pesos,how much will 2 and 1/2 kilograms of fish cost? 2)At 40 for every...
- A construction project uses a scale of 1 inch = 4 ft the dimensions of the room on the scale...