Write a program that uses BirdSurvey to record the data from a recent bird survey. Use a loop to read bird names until done is entered. Display a report when finished.
Suppose that we would like to perform a bird survey to count the number of birds of each species in an area. Create a class BirdSurvey that is like one of the linked-list classes given in this chapter. (The linked list you use will affect what your new class can do, so give some thought to your choice.) Modify the inner node class to add room for a count.
BirdSurvey should have the following operations:
• add(bird)—adds the bird species bird to the end of the list, if it is not already there, and sets its count to 1; otherwise, adds 1 to the count for bird.
• getCount(bird)—returns the count associated with the species bird. If bird is not on the list, returns zero.
• getReport—displays the name and count for each bird species on the list.
The solution is loosely based on the generic version of the linked list given in Listing 12.12. The definition of node needs to be changed to include an extra piece of data (the count). The add method must be modified to do a search first and increment the count if the bird is already in the list. Notice that once a link is set, it never needs to be changed.
See the code in BirdSurvey.java.
You might also like to view...
What extension should be used to name HTML files?
(a) .html (b) .zip (c) .bat (d) none of the above.
While most of the Network+ exam is extremely practical and deals with real-world scenarios, you can also expect conceptual questions about the OSI seven-layer model.
Answer the following statement true (T) or false (F)
Identify the letter of the choice that best matches the phrase or definition.
A. Opens a Word Help window with an explanation of the grammar or style rule being applied. B. Opens the Proofing section in the Word Options dialog box to allow you to change default spelling and grammar check settings. C. Leaves the flagged error untouched or changes the flagged error to the correction you type in the top box in the dialog box, and then jumps to the next flagged error. D. Leaves the flagged error untouched and jumps to the next flagged error; changes to Resume if you click in the document to correct the error; and changes to Undo Edit if you correct a change in the top box. E. Leaves all instances of errors that violate the identified grammar rule untouched and jumps to the next flagged error.
A subject line is used to direct a letter to a specific individual, position, or department within an organization.
Answer the following statement true (T) or false (F)