CEIS295 Lab 3: All exercises – Header and cpp files included for all exercises with screenshots – Perfect Solution – Instant Delivery
WEEK 3: LAB OVERVIEW
Table of Contents
The purpose of the Lab exercises is to help the student acquire skills in developing programs that involve the use of the stack and the queue data structures.
There are six exercises in this Lab, although not all of them will be required for submission. Be sure to read the following instructions carefully.
• Exercises 1 and 4: No submissions are required.
• Create a folder and name it Week 3 Lab. Inside this folder, create the subfolders Ex2, Ex3, Ex5, and Ex6. Place the solution to each of the four exercises required for submission in the corresponding subfolder. Compress the folder Week 3 Lab, and submit the resulting zipped folder.
• Note that Exercises 2, 3, 5, and 6 require software development. For each of them, place in the corresponding folder the source code files (i.e., .h and .cpp files) you created, and a screenshot of the execution window. Do not submit other files or folders, including those automatically generated by the IDE.
Use a personal copy or access the software at https://lab.devry.edu (Links to an external site.)Links to an external site..
Exercise 1: Review of the Stack ADT
Create a project, A Simple Stack Class, using the programs in:
• A Simple Stack Class (Links to an external site.)Links to an external site.
Compile the project, run it, and review the code that is given carefully. This program tests the Stack class discussed in the lesson.
Exercise 2: An Improved Stack Class
Modify the Stack class to include appropriate error messages if invalid conditions occur—for example, trying to pop an item when the stack is empty.
Exercise 3: Using a Stack in an Application
Complete Project P-5.12 at the end of Chapter 5 in our textbook: Implement a program that can input an expression in postfix notation (see Exercise C-5.8) and output its value. As you can see, you will need to read Exercise C-5.8 to complete this programming task.
To implement the solution to this problem, you are allowed to use the stack of characters from the previous exercises (1 and 2).
Implement a program that can input an expression in postfix notation (see Exercise C-5.8) and output its value.
Postfix notation is an unambiguous way of writing an arithmetic expression without parentheses. It is defined so that if “(exp1) o (exp2)” is a normal fully parenthesized expression whose operation is “o”, then the postfix version of this is “pexp1 pexp2o”, where pexp1 is the postfix version of exp1 and pexp2 is the postfix version of exp2. The postfix version of a single number or variable is just that number or variable. So, for example, the postfix version of “((5 + 2) * (8 − 3))/4” is “5 2 + 8 3 −* 4 /”. Describe a nonrecursive way of evaluating an expression in postfix notation.
Exercise 4: Review of the Queue ADT
Create a project, A Simple Queue Class, using the programs in:
• A Simple Queue Class (Links to an external site.)Links to an external site.
Compile the project, run it, and review the code that is given carefully. This program tests the Queue class discussed in the lesson.
Exercise 5: An Improved Queue Class
Modify the Queue class to include appropriate error messages if invalid conditions occur—for example, trying to dequeue an item when the queue is empty.
Exercise 6: Using a Queue in an Application
Write an application to simulate an automatic call distributor or ACD. ACDs are used in call centers to route incoming calls to available agents. The application should consist of
• an automatic call distributor (ACD) object; and
• calls to be handled (each call is an object of the type Call).
The ACD object should contain a queue to store the information of the calls (therefore, the item type stored in your Queue class should be Call). Each Call object contains the associated phone number, date it was made, time it was made, a random ID, and a language chosen by the customer who made the call. Test your classes by deciding in main() the next action randomly: a call leaves the queue (call has been routed to an agent), a new call arrives to the queue, or simply do nothing (the state of the system remains the same).