CPSC 2430-02 Programming Assignment #1

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (8 votes)

P1 is a warm up to classes in C++, including dynamic memory
Create a Stack class that can handle characters. It should be able to automatically resize (to a larger
size only) when full, becoming 1.5 times larger than it was. The stack class must contain the standard
public functionality of push(), pop(), empty(). The only additional public functionality allowed is a
peek() or top() method, depending upon your design choice.
Do not use any of the STL (including the vector type) in your Stack.
Test your Stack class by writing a driver that can determine if a provided string is a palindrome. Note
that the strings will contain spaces and punctuation and these are not part of the palindrome.
There is an unknown number of strings in the file – each is on a single line.
The output should appear on the screen and list the string (with the punctuation and spaces intact)
followed by whether or not it is a palindrome as in:
“Mom” is a palindrome.
“Cat” is NOT a palindrome.
“Madam, I’m Adam” is a palindrome.
Use the provided file for input (instructions below).
Submit your (compiled) program using the following command:
/home/fac/sreeder/submit/cpsc2430/p1_runme
The Stack class will be in two files named “stack.h” and “stack.cpp”. The driver will be in a file named
“p1.cpp”.
The input file can be found on the cs1 server. Create a constant string for the filename, such as:
const string READFILE = “/home/fac/sreeder/class/cs2430/p1input.dat”;
Other useful references for this assignment include the sample program “fileReading.cpp” found
in the Course Information module of this course site as well as the page on the string type at
http://cppreference.com or http://cplusplus.com. Note that C++ strings can be treated as arrays of
characters, so you can use standard array techniques and the character comparison functions from the
cctype package.