Question: please read the lab question clearly and provide comments and solutions according to it. its java coding package DataStructureType; public class Genericstack private T[ ]

 please read the lab question clearly and provide comments and solutions

according to it. its java coding package DataStructureType; public class Genericstack private

T[ ] data; private int top; private int size; public GenericStack( )

top--l; size - 100; data- (T) new Object[ 1001; public GenericStack(int n)

top - 1; size - n; data - (T) new Object[n]; public

boolean push(T newNode) //GenericNode node -(GenericNode) newNode; if (top else size-1) return

false; overflow error ** top top 1; //data[top](T) node.deepCopy) data topnewNode; return

true; // push operation successful public T pop() ( int topLocation; if

(top1) return null; //** underflow error ** else topLocation-top; top top -1;

return data[ topLocation]; public boolean push(T newNode) //GenericNode node -(GenericNode) newNode; if

(top else size-1) return false; *overflow error ** top top +1; //data[top](T)

please read the lab question clearly and provide comments and solutions according to it.

its java coding

package DataStructureType; public class Genericstack private T[ ] data; private int top; private int size; public GenericStack( ) top--l; size - 100; data- (T) new Object[ 1001; public GenericStack(int n) top - 1; size - n; data - (T) new Object[n]; public boolean push(T newNode) //GenericNode node -(GenericNode) newNode; if (top else size-1) return false; overflow error ** top top 1; //data[top](T) node.deepCopy) data topnewNode; return true; // push operation successful public T pop() ( int topLocation; if (top1) return null; //** underflow error ** else topLocation-top; top top -1; return data[ topLocation]; public boolean push(T newNode) //GenericNode node -(GenericNode) newNode; if (top else size-1) return false; *overflow error ** top top +1; //data[top](T) node.deepCopy); data topnewNode; return true; // push operation successful public T pop() ( int topLocation; if(top 1) return null; /*underflow error ** else topLocation-top; top-top -1; return data[ topLocation]; public void showAll ) for (int i - top; >. 0; i--) System.out.println (data[i].toString()) Create the project SP2019_PART1_YourLastName -Re-use the class Account_yourLastName, CheckingAccount yourLastName, SavingAccount_yourLastName from lab 3 Class Account_yourLastname only have two data members, account number (String), balance (double) Class CheckingAccount only have one field: serviceFee (double) Class SavingAccount only have one field: interestRate(double) Add the class data structure Stack and Queue (You can use the code on the page 140 (Stack) and page 160 (Queue) for your reference The driver class named as SP2019_RestrictedStructureDemo yourLastName REQUIREMENT Provide the application that can demo all the operations of the Restricted data structure -Create a menu to allow users to select the data structure types; RESTRICTED DATA STRUCTURE YOUR NAME 1. Stack structure 2. Queue structure 0. Exit Read selected type Create the data structure; it can be Stack or Queue depending on selected type, then do the following tasks: You should allow users to continue using your program until they want to exit PART2 Requirement Evaluating the inFixed Expression Create a project named SP2019_PART2_yourLastName Add a data structure named GenericStack (downloaded from eCampus Lab3) Provide the application (Driver class) named SP2019_EvaluatelnfixedExpression_yourLastName that allows users to evaluate the infixed expressions. First, allow users to select where the expression comes from: 1. 2. 0. One Expression from the keyboard Expressions from an input file Exit After complete one task, you should re-display the menu to allow users to continue using the program until the users want to exit Case 1://input from the keyboard -After reading one expression as a string from the keyboard -Using StringTokenizer or split of String to split input expression into the tokens (operands and operators) and store them to stack of operands and stact of operators by applying the following rules: PHASE 1: Scanning expression (read expression) the program will scan the expression from left to right to extract operands (numbers), operators (+and the parenthesis if the extracted item is a number, push it to the stackForOperands if the extracted item is an open parenthesis "(", push it to stackForOperators if the extracted item is a or- oror/ -check if the StackForOperators is empty or at top of the StackForOperators is not open parenthesis "(", push it into the stack Otherwise: if extracted item is+ or-, create a loop to process the operator at top of the stackForOperators by calling the method processOneOperator until the top is not +,- or + if extracted item is *or /, create a loop to process the operators at top of the stackForOperators by calling the method processOneOperator until the top is not* or Then push the extracted item in to the stack if the extracted item is an close parenthesis ), process all operators in the stackForOperators by calling the method processOneOperator until the top is open parenthesis "("; then pop the open parentheris off from the stack DO THE PHASE DO THE PHASE 2 DISPLAY THE RESULT Method processOneOperator (a user-defined function) Pop one operator from stackForOperators Pop two operands from stackForOperands Calculate the result based on the operation Push the result back to the stackForOperands Note: to be easy to organize the program structure, you should create a user-defined function processOneExpression that handle all task that need for one expression PART1 class Stack yourLastName, class Queue_yourLastName Data type class with inheritance SP2019LAB4_RestrictedStructureDemo_yourLastName .handle menu in loop . declare Stack, insert nodes, remove nodes, display top, showAII . declare Queue, insert nodes, remove nodes, display front, showAll compile success do all the requirement - polymorphisnm Class GenericStack Class FA2018LAB4 EvaluatelnfixedExpression_yourLastName Declare the stack of operators Declare the stack of operands Menu handle to allow users select keyboard or file or exit Read expression from keyboard Read expression from the file all lines Use StringTokenizer or split to split the expression to tokens Function for one Operator Process

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!