Java Reference
In-Depth Information
punctuation, and other non-alphanumeric characters are
ignored. The program should print the results of both tests.
PP 13.9
Design and implement a class named StringTree , a binary
tree for storing String objects in alphabetic order. Each node
in the tree should be represented by a Node class, which stores
the string value and pointers to the right and left child nodes.
For any node value in the tree, the value of its left child should
come before that value, and the value of its right child should
come after that value. The StringTree class should contain
both a method for adding strings to the tree and a method for
printing the tree's value in alphabetic order. Write a driver
program that prompts the user for strings and adds them to
the tree. After processing the input, print the tree values.
PP 13.10
Design and implement an application to support a moder-
ated question-and-answer session in which audience members
submit questions to a queue. The question at the front of the
queue may be answered by the speaker or panel, and a list of
answered or unanswered questions may be retrieved at any
time.
The program should accept the following simple commands:
'Q' will allow an audience member to submit a question, along
with their name; 'A' will allow the speaker to enter an answer
to the question currently at the top of the queue; 'P' will allow
the speaker to pass on a question, moving it from the front of
the queue to the end of the queue; 'R' will allow the speaker to
mark a question as rejected, removing it from the queue; 'LA'
will print a numbered list of answered questions, along with
the answers; 'LU' will print a numbered list of unanswered
questions; finally, 'X' will print numbered lists of answered
and unanswered questions, then exit the program.
You should create a Question class to store each question,
its answer, and any other question state information. The
answered and unanswered queues should be implemented
using the java.util.LinkedList class. You must use only the
methods in the class that provide Queue functionality: remove
the first element, append an element to the end, retrieve the
queue size, and iterate over the list.
 
Search WWH ::




Custom Search