I am doing an assignment for class and it requires me to Develop an algorithm using the Java programming language that implements a "> I am doing an assignment for class and it requires me to Develop an algo">

#### Question Details

##### [solution] » I am doing an assignment for class and it requires me to Develop an algo

Brief item decscription

Item details:

I am doing an assignment for class and it requires me to Develop an algorithm using the Java programming language that implements a basic stack data structure.

Here is the scenario: Assume that you are developing a system for a manufacturing assembly line that builds automobiles. There are three stations in the manufacturing line where an inspector will visually inspect the vehicle. You program must keep track of these inspections as they occur. You decided to develop your program using a stack data structure. As your vehicle begins the line you will push the number 0, which indicates that that an inspection has not yet occurred, onto the stack three subsequent times. At each station in the line you will pop one of the items off of the stack. Each time your algorithm pops an item from the stack you must print it out to the console using the system.out.println function. I will post my code below. Does my code represent this scenario and how do i perform the Asymptotic analysis of my algorithm?

My Code:

import jeliot.io.*; public class MyStack { private int maxSize; private long[] stackArray; private int top; public MyStack(int s) { maxSize = s; stackArray = new long[maxSize]; top = -1; } public void push(long j) { stackArray[++top] = j; } public long pop() { return stackArray[top--]; } public long peek() { return stackArray[top]; } public boolean isEmpty() { return (top == -1); } public boolean isFull() { return (top == maxSize - 1); } public static void main(String[] args) { MyStack theStack = new MyStack(5); theStack.push(0); theStack.push(1); theStack.push(2); theStack.push(3); theStack.push(4); while (!theStack.isEmpty()) { long value = theStack.pop(); System.out.print(value); System.out.print(" "); } System.out.println(""); } }

Notice: Undefined index: payment_status in /home/aceyourh/studycourse.fun/wp-content/themes/premier/page-templates/paper-detail.php on line 248

STATUS
QUALITY
Approved

This question was answered on: Oct 14, 2020

Solution~000121875.zip (18.37 KB)