(A) Implement generic class ArrayStack as discussed in the lectures having following methods: constructor, push, pop, peek, isEmpty, copy constructor, reallocate (private method). Also add following methods to this class: size: returns number of elements in the stack. contains: Search an element in the stack. If found returns true, else returns false. clear: Deletes all elements of the stack and make it empty stack. (B) Implement generic class ArrayQueue as discussed in the lectures having following methods: constructor, copy constructor, offer, poll, peek, isEmpty, reallocate(private), iterator. Inner class Iter that implements interface Iterator having methods: constructor, hasNext, next. Also add following methods to the ArrayQueue class: size: returns number of elements in the queue. contains: Search an element in the stack. If found returns true, else returns false. clear: Deletes all elements of the stack and make it empty stack. (C) Write a class called PalindromeChecker having method isPalindrome having a parameter line of type String. The method changes each uppercase letter of line to lowercase, and places each letter of the String line in a queue and also onto a stack. The program should then verify whether the line of text is a palindrome. Include method main to check several Strings, whether each one is a palindrome or not.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 16PE: The implementation of a queue in an array, as given in this chapter, uses the variable count to...
icon
Related questions
Question
  • java program:
  •  
  • Implement generic class ArrayStack as discussed in the lectures having following methods:

constructor, push, pop, peek, isEmpty, copy constructor, reallocate (private method).

Also add following methods to this class:

size: returns number of elements in the stack.

contains: Search an element in the stack. If found returns true, else returns false.

clear: Deletes all elements of the stack and make it empty stack.

  • Implement generic class ArrayQueue as discussed in the lectures having following methods:

constructor, copy constructor, offer, poll, peek, isEmpty, reallocate(private), iterator.

Inner class Iter that implements interface Iterator having methods: constructor, hasNext, next.

Also add following methods to the ArrayQueue class:

size: returns number of elements in the queue.

contains: Search an element in the stack. If found returns true, else returns false.

clear: Deletes all elements of the stack and make it empty stack.

  • Write a class called PalindromeChecker having method isPalindrome having a parameter line of type String. The method changes each uppercase letter of line to lowercase, and places each letter of the String line in a queue and also onto a stack. The program should then verify whether the line of text is a palindrome. Include method main to check several Strings, whether each one is a palindrome or not.
(A) Implement generic class ArrayStack as discussed in the lectures having following methods:
constructor, push, pop, peek, isEmpty, copy constructor, reallocate (private method).
Also add following methods to this class:
size: returns number of elements in the stack.
contains: Search an element in the stack. If found returns true, else returns false.
clear: Deletes all elements of the stack and make it empty stack.
(B) Implement generic class ArrayQueue as discussed in the lectures having following methods:
constructor, copy constructor, offer, poll, peek, isEmpty, reallocate(private), iterator.
Inner class Iter that implements interface Iterator having methods: constructor, hasNext, next.
u
Also add following methods to the ArrayQueue class:
size: returns number of elements in the queue.
contains: Search an element in the stack. If found returns true, else returns false.
clear: Deletes all elements of the stack and make it empty stack.
(C) Write a class called PalindromeChecker having method isPalindrome having a parameter line
of type String. The method changes each uppercase letter of line to lowercase, and places each
letter of the String line in a queue and also onto a stack. The program should then verify whether
the line of text is a palindrome. Include method main to check several Strings, whether each one
is a palindrome or not.
Transcribed Image Text:(A) Implement generic class ArrayStack as discussed in the lectures having following methods: constructor, push, pop, peek, isEmpty, copy constructor, reallocate (private method). Also add following methods to this class: size: returns number of elements in the stack. contains: Search an element in the stack. If found returns true, else returns false. clear: Deletes all elements of the stack and make it empty stack. (B) Implement generic class ArrayQueue as discussed in the lectures having following methods: constructor, copy constructor, offer, poll, peek, isEmpty, reallocate(private), iterator. Inner class Iter that implements interface Iterator having methods: constructor, hasNext, next. u Also add following methods to the ArrayQueue class: size: returns number of elements in the queue. contains: Search an element in the stack. If found returns true, else returns false. clear: Deletes all elements of the stack and make it empty stack. (C) Write a class called PalindromeChecker having method isPalindrome having a parameter line of type String. The method changes each uppercase letter of line to lowercase, and places each letter of the String line in a queue and also onto a stack. The program should then verify whether the line of text is a palindrome. Include method main to check several Strings, whether each one is a palindrome or not.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Stack
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning