Write a
1. Each digit or operator should be separated by a space, and end with ':' character.
2. You should apply the stack ADT in the program.
3. You may need to use function is digit(int c) in standard header file #include <cctype> to check if the token character is a digit or not.
4. To convert the single-digit char c to the represented integer num, a simple method is to assign num by aChar - '0'
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- Project Overview: This project is for testing the use and understanding of stacks. In this assignment, you will be writing a program that reads in a stream of text and tests for mismatched delimiters. First, you will create a stack class that stores, in each node, a character (char), a line number (int) and a character count (int). This can either be based on a dynamic stack or a static stack from the book, modified according to these requirements. I suggest using a stack of structs that have the char, line number and character count as members, but you can do this separately if you wish.Second, your program should start reading in lines of text from the user. This reading in of lines of text (using getline) should only end when it receives the line “DONE”.While the text is being read, you will use this stack to test for matching “blocks”. That is, the text coming in will have the delimiters to bracket information into blocks, the braces {}, parentheses (), and brackets [ ]. A string…arrow_forwardjava /* Practice Stacks and ourVector Write a java program that creates a stack of integers. Fill the stack with 30 random numbers between -300 and +300. A)- With the help of one ourVector Object and an additional stack, reorganize the numbers in the stack so that numbers smaller than -100 go to the bottom of the stack, numbers between -100 and +100 in the middle and numbers larger than +100 in the top (order does not matter) B)- (a little harder) Solve the same problem using only one ourVector object for help C)- (harder) Solve the same problem using only one additional stack as a helper */ public class HWStacks { public static void main(String[] args) { // TODO Auto-generated method stub } }arrow_forwardYou are given a mathematical expression in postfix notation (RPN). During the postfix expression evaluation algorithm, enter the value that would be at the bottom of the stack after processing the 6th token on the following input: 372-+ 6 * (Note this is not about expression trees, this is just the stack-based algorithm for evaluating a post fix expression.)arrow_forward
- Explain Please pleasearrow_forwardWrite a program that takes as input an arithmetic expression. The program outputs whether the expression contains matching grouping symbols (brackets and parentheses). For example, the arithmetic expressions {25 + (3 – 6) * 8} and 7 + 8 * 2 contains matching grouping symbols. However, the expression 5 + {(13 + 7) / 8 - 2 * 9 does not contain matching grouping symbols. You must use a stack and/or queue. USE THE FOLLOWING DATA FILE //Header file: stackADT.h #ifndef H_StackADT#define H_StackADT template <class Type>class stackADT{public:virtual void initializeStack() = 0;//Method to initialize the stack to an empty state.//Postcondition: Stack is emptyvirtual bool isEmptyStack() const = 0;//Function to determine whether the stack is empty.//Postcondition: Returns true if the stack is empty,// otherwise returns false.virtual bool isFullStack() const = 0;//Function to determine whether the stack is full.//Postcondition: Returns true if the stack is full,// otherwise returns…arrow_forwardYou will create two programs. The first one will use the data structure Stack and the other program will use the data structure Queue. Keep in mind that you should already know from your video and free textbook that Java uses a LinkedList integration for Queue. Stack Program Create a deck of cards using an array (Array size 15). Each card is an object. So you will have to create a Card class that has a value (1 - 10, Jack, Queen, King, Ace) and suit (clubs, diamonds, heart, spade). You will create a stack and randomly pick a card from the deck to put be pushed onto the stack. You will repeat this 5 times. Then you will take cards off the top of the stack (pop) and reveal the values of the cards in the output. As a challenge, you may have the user guess the value and suit of the card at the bottom of the stack. Queue Program There is a new concert coming to town. This concert is popular and has a long line. The line uses the data structure Queue. The people in the line are objects…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY