1.Write a function named filterOnMax that takes a queue of integers and an integ
ID: 3534501 • Letter: 1
Question
1.Write a function named filterOnMax that takes a queue of integers and an integer value named max as parameters and returns a new queue of integers that contains only the values in the original queue that are less than or equal to the value of max. The new queue should preserve the order of the old Queue, and the old Queue should be empty when this method is finished. There is no guarantee that the values in the input queue will be sorted. Your function should display an understanding of FIFO Queue processing so make sure your code use only queue operations on the queue objects (push, pop, front, etc).
2. Write a function named filterOutVowels that takes a stack of characters and returns a new stack of characters that contains only the values in the original stack that are not vowels ('a','e','i','o','u'). When the method is complete, the original stack should be empty. The new stack must have its elements in the same order as the original stack, so you will need to do something to preserve the order of the original stack as you are making your choices (hint - you will want to use a third stack beyond just the input and output stacks). Your code should work for capital or lowercase letters. Your method should display an understanding of stack processing, so make sure your code uses only stack operations on your stack objects (push, pop, and top).
3.Write your code using good modular design, i.e. use functions effectively and do not just put all of your code in the main method.
4. All functions should be written AFTER the main procedure
5. A function prototype should be written for each function and placed BEFORE the main procedure
6. Each function should have a comment explaining what it does
7. Each function parameter should have a comment explaining the parameter
Explanation / Answer
Please rate with 5 stars :) You could use this as a reference :) http://stackoverflow.com/questions/11810406/how-to-replace-replace-vowels-with-a-special-character-in-java This clearly explains how to replace characters in a queue. You simply have to delete them, no other change at all :) Cheers!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.