Due Date: Monday, April 5, 2010, or Tuesday, April 6, 2010,
depending on the day of your lab.
Objective: The goal of this assignment is to practice stacks and queues.
Assignment: Write the following two programs.
- Write a program that uses a stack to check whether a given string is a palindrome -- i.e.,
whether it reads the same from the beginning and from the end. For example, "Madam, I'm Adam." is a palindrome.
According to the general rule of
the palindrome, when we check whether a given string is a palindrome, we:
- ignore spaces,
- ignore non-letter symbols (commas, periods, etc.),
- ignore the difference between capital and small versions
of the same letter (e.g., "m" and "M" in the above example).
- Write a program that uses a queue to simulate a
line of students waiting to be advised for Fall 2010 (by the way, it is already possible to get advised!).
A student is characterized by his or her name and major.
Enable the user of your method to
indicate when a new student is coming (and insert the name and the major of the new student),
and when the student in front of the line is served (so he or she is no longer in the line).
At any given moment, the user should also be able to print the list of all the
students who are currently waiting in the line.