Question: ( CSCI 2 5 1 ) Project Two Implement and Apply Stack and Queue Purpose: The purpose for this project is to reinforce the knowledge
CSCI Project Two Implement and Apply Stack and Queue Purpose:
The purpose for this project is to reinforce the knowledge from Chapter Two of the textbook. The students will practice how to implement stack and queue data structure using list structure, for instance, ArrayList. The students will also apply stack and queue in real project, for instance, to check if a string is a palindrom.
Tasks: Use ArrayList to implement MyStack class which define the data structure that has Last In First Out property
Use ArrayList to implement MyQueue class which define the data structure that has First In First Out property
Write a function public static Boolean isPalindromeString sentence
This function returns true if sentence is a palindrome; false otherwise.
Sample files: Three sample files are given. The students should add necessary comments to all files and implement all functionalities in the given files.
No extra functions can be added. No function name can be changed. The students should run the executable jar file to see how project should run.
The students should zip whole project and submit it via blackboard link.
CSCIProjTwo.cpp
ProjectTwoCSCI
#include
#include
#include
#include "MyStack.h
#include "MyQueue.h
using namespace std;
bool isPalindromestring sentence;
int main
string sentence;
char choice;
do
cout "Enter a sentence: ;
getlinecin sentence;
cout sentence ;
ifisPalindromesentence
cout is a palindrome" endl;
else
cout is NOT a palindrome" endl;
cout Do you want to make another check? YN :;
cin choice; get input char
cin.ignore; ignore new lines
whilechoice y choice Y;
cout "Thanks for choose the ;
return ;
bool isPalindromestring sentence
you implement this
MyQueue.hpp
#ifndef MyQueueh
#define MyQueueh
#include
#include
using namespace std;
template
class MyQueue
public:
MyQueue;
T pop;
void pushT item;
T peek const;
int size const;
bool isEmpty const;
private:
list q; we use a list to hold data for queue
;
#include "MyQueue.cpp
#endif MyQueuehpp
MyStack.h
#ifndef MyStackh
#define MyStackh
#include
#include
using namespace std;
template
class MyStack
public:
MyStack;
void pushT item;
T pop;
T peek const; const means that the function will not change the content of the object
int size const;
bool isEmpty const;
private:
vector v; use a vector to hold data in stack
;
#include "MyStack.cpp
#endif MyStackhpp
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
