Question: Hey, it is my assignment; I need someone helps to complete this code by C#. thank you Complete the attached MyLinkedStack.cs. (50 points) Part1. Complete

Hey,

it is my assignment; I need someone helps to complete this code by C#. thank you

Complete the attached MyLinkedStack.cs. (50 points)

Part1. Complete the MyListStack. There are four methods to be completed: Push(), Pop(), IsEmpty() and Size() .

Part2. Complete a method to evaluate postfix expressions using MyListStack. (Don't know what is postfix! Refer to my slides on Stacks in Course Documents.)

------------------------------------------------------------------------

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace StackExperiment { //we use TestStackProgram to test our program class TestStackProgram { static void Main(string[] args) { MyListStack myStack = new MyListStack();

string testString = "78+2*5-";

int result = EvaluatePostFix(testString, myStack);

Console.WriteLine("The expression produces: "+ result);

Console.ReadKey();

}

//Part 2: Complete this method to evaluate Postfix Expressions using MyListStack static int EvaluatePostFix(string testString, MyListStack stack) {

}

}

//definition of each Node of Stack public class Node { public int data; public Node next;

public Node(int item) { data = item; next = null; } }

//Part 1: Complete class MyListStack public class MyListStack { //top element private Node top = null; // number of elements stored private int numberOfNodes = 0;

//indicates whether no elements are stored public bool IsEmpty() {

}

//returns the number of elements stored public int Size() {

}

//inserts an element public void Push(int item) {

}

//removes and returns the last inserted element public int Pop() {

}

}

}

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!