Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have to use a h file for class definitions and two (as specified below) cpp file for the C++ implementation. You have to generate

image text in transcribed

You have to use a h file for class definitions and two (as specified below) cpp file for the C++ implementation. You have to generate the list from scratch and check for overflow I will be giving extra points (up to 2 points this time) to students that exceed the requirements posed in the assignments. For example, extensive testing, checking for exceptions, and usable user interface. Please submit enough screenshots showing compiling and execution under Linux. Write a main program that uses the list based queue class (defined below) to check if an input string is of the form a^n b^n a^n, meaning n times the character 'a' followed by n times the charter 'b', followed by n times the character 'a'. For example, consider: 'aaaabbbbaaaa' vs. 'aaabbbbaa' or 'abaabbab' You should modularize your program using: AnBnAn.cpp, LQ.cpp and LQ.h. The program should use the following algorithm: 1. Scan the string from left to right until reaching the NULL terminator. 2. If you reach any character that is different than 'a' or 'b' then the string is invalid 3. If the string does not start with an 'a' then the string is invalid 4. Next, for every occurrence of the character 'a' insert the character b' to the queue. 5. Once you reach the first 'b' character in the string do: for each 'b' in the string remove a 'b' from the queue and insert an 'a' to the queue. Finally, once you reach the first 'a' character in the string remove an 'a' character from the queue for every 'a' character encountered. If (5) cannot be followed (e.g., an 'a' is encountered within a 'b' characters the string is considered invalid. 6. The string is valid if upon reaching the NULL character the queue is empty and no overflow or underflow has accrued. Write a class LLQ that implements a Queue in linked a list of characters. The class should include the following "utilities": 1. A constructor and a destructor 2. At least one inline getter and one inline setter for private members 3. An insert function that gets a character value and inserts it at the "end" of the queue 4. A remove function that gets the value of the "first" queue element and stores it in a character variable 5. A Boolean function 'is_full' that returns true if the queue is "full" (otherwise it returns false). This function should be called before inserting items to the queue. 6. A Boolean function 'is_empty' that returns true if the queue is "empty" (otherwise it returns false). This function should be called before removing items from the queue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions

Question

How can either be made stronger?

Answered: 1 week ago

Question

3. Discuss the process of behavior modeling training.

Answered: 1 week ago