Write a pure abstract class named Token that has the following virtual functions. public: virtual float PuNumber0=0; / pure virtual functions virtual char PutOperatoro=0; Derive a class named Operator...


Please Solve theQuestion in C++as quickly as you can in40 minutes. And do the same as asked in the question.Don't use extra things, please.


Write a pure abstract class named Token that has the following virtual functions.<br>public:<br>virtual float PuNumber0=0; / pure virtual functions<br>virtual char PutOperatoro=0;<br>Derive a class named Operator from Token class that has following member variables and<br>finctions.<br>private:<br>char gper; // operators +, , *,/<br>public:<br>Operator(char); // constructor sets value<br>char Butperator0; // displays character operator<br>float PutNumberO:// dummy function, does nothing<br>Derive a class named Number from Token class that has following member variables and<br>functions.<br>private:<br>float fgum; // the number<br>public:<br>Number(float); / constructor sets value<br>float PutNumberO: // displays number<br>char Buteerator0; // dummy function, does nothing<br>Next Write a class named Stack that has the following member variables and functions.<br>Kariables int Top, Token *array[2];<br>Functions: A constructor to initialize the variables.<br>A Push function to push a Token object in to the stack.<br>A Pop function to retum a Token object from the stack<br>Write a main function that will declare pointer array of type Token having size 2 and initialize the<br>array with the objects of type Operator and Number respectively. Then declare an object of Stack<br>class and call a push function to push object of type Token holding Operator object on to the stack.<br>Then call a pop function to returm object of type Token and call PutOperator function to display<br>the operator.<br>Similarly push object of type Token holding Number object on to the stack. Then call a pop<br>fumction to returm object of type Token and call PutNumber fimction to display the number.<br>Note: Do not change the names of functions and variables. Otherwise, marks will be deducted.<br>Do not define extra functions except for constructors.<br>

Extracted text: Write a pure abstract class named Token that has the following virtual functions. public: virtual float PuNumber0=0; / pure virtual functions virtual char PutOperatoro=0; Derive a class named Operator from Token class that has following member variables and finctions. private: char gper; // operators +, , *,/ public: Operator(char); // constructor sets value char Butperator0; // displays character operator float PutNumberO:// dummy function, does nothing Derive a class named Number from Token class that has following member variables and functions. private: float fgum; // the number public: Number(float); / constructor sets value float PutNumberO: // displays number char Buteerator0; // dummy function, does nothing Next Write a class named Stack that has the following member variables and functions. Kariables int Top, Token *array[2]; Functions: A constructor to initialize the variables. A Push function to push a Token object in to the stack. A Pop function to retum a Token object from the stack Write a main function that will declare pointer array of type Token having size 2 and initialize the array with the objects of type Operator and Number respectively. Then declare an object of Stack class and call a push function to push object of type Token holding Operator object on to the stack. Then call a pop function to returm object of type Token and call PutOperator function to display the operator. Similarly push object of type Token holding Number object on to the stack. Then call a pop fumction to returm object of type Token and call PutNumber fimction to display the number. Note: Do not change the names of functions and variables. Otherwise, marks will be deducted. Do not define extra functions except for constructors.
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here