Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( A ) Implement generic class ArrayStack as discussed in the lectures having following methods: constructor, push, pop, peek, isEmpty, copy constructor, reallocate ( private
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, reallocateprivate 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 queue. If found returns true, else returns false.
clear: Deletes all elements of the queue 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started