CST242 Project 8: Chapter 21
Generic Classes and Methods
-
Create a new Java project named "project-8" from the instructions for one of
the exercises at the conclusion of Chapter 21 in which you should use the
"ListNode.java" and "List.java" classes as well as when appropriate either
"Stack.java" or "Queue.java" all of which were presented in class lecture
(do no use
Stack
or Queue
classes from the Java API):
-
21.6 (Concatenating Lists)
Complete this assignment as written for a maximum of
8½ out of 10 points;
even though input to this application are two link-lists of characters
(type
char
), the class ListConcatenate<E>
should be generic; the static
method concatenate
which returns the concatenated list is its only member (there are no instance
variables)
-
21.10 (Printing a Sentence in Reverse Using a Stack)
Complete this assignment as written for a maximum of
8 out of 10 points;
write this exercise as an interactive application with user input in the form of
an entire sentence from a
Scanner
object
-
21.11 (Palindrome Tester)
Complete this assignment as written for a maximum of
9 out of 10 points;
write this exercise as an interactive application with user input in the form
of the text to be tested from a
Scanner
object; initially use
String
manipulation methods to remove all spaces and punctuation
from the input before pushing the characters onto the stack
-
21.15 (Supermarket Simulation)
Complete this assignment as written for a maximum of
10; out of 10 points;
use a
for
loop to count the minutes; if for example the store opens at
9:00 a.m. and closes at 9:00 p.m. then output randomly might look like the following:
Customer 1 arrives at 09:03 a.m.
Customer 2 arrives at 09:05 a.m.
Customer 1 service completed at 09:06 a.m.
Customer 3 arrives at 09:09 a.m.
Customer 2 service completed at 09:09 a.m.
Customer 4 arrives at 09:11 a.m.
Customer 3 service completed at 09:12 a.m.
etc.
In response to Questions #'s 1 and 2 in the assignment, display the "Maximum number
of customers in the queue" and "Longest wait any one customer experiences" as output
from the program after conclusion of the for
loop; experiment with
Question #3 "Change the arrival interval to 1 to 3 minutes" but that does not
require additional displayed output
Also it might be useful to create a programmer-defined class ClockDisplay
to take the for
loop counter-variable as input and convert it to time
with hours, minutes and am/pm
Hint: as per the suggestion above, if the store hours are
open from 9:00 a.m. to 9:00 p.m. consider iterating the for
loop from
540 (number of minutes equivalent to 9:00 a.m.) to 1260 (number of minutes equivalent
to 9:00 p.m.) rather than zero (0) to 720
-
Reminder: all of these exercises should use intact the
ListNode<E>
and List<E>
classes from
the chapter; additionally Exercises 21.10 and 21.11
should incorporate the Stack<E>
class and Exercise
21.15 the Queue<E>
class
-
Provide full documentation using the Javadoc standard and based upon the
downloaded sample files for the unit
-
Students may work on all projects in teams of two or three,
and, if so, all students in the group must submit the same project to their own dropboxes
in Brightspace. In the text box's dropbox, as well as in the source code documentation
(comments), state the name(s) of the classmate(s) with whom you worked.
-
When all steps are finished, create a .ZIP archive (not a .RAR)
of the entire project. This completed assignment with a copy of all files from the
NetBeans project submitted electronically via an attachment to a
Brightspace
dropbox is due to Prof. Struck by 11:59 p.m. on the date specified in the course outline.