Course Solutions Uncategorized (Solved) : Need Help Answering Write Questions Import Javautilemptystackexception Public Class Arrays Q29708923 . . . .

(Solved) : Need Help Answering Write Questions Import Javautilemptystackexception Public Class Arrays Q29708923 . . . .

 

I need help for answering the write up questions

import java.util.EmptyStackException;

public class ArrayStack implements DStack { // (alternateversion, using an array)

private double[] items = new double[10]; // Holds the items onthe stack.

private int top = 0; // The number of items currently on thestack.

/**
* Add N to the top of the stack.
*/
public void push( double N ) {
if (top == items.length) {
// The array is full, so make a new, larger array and
// copy the current stack items into it. (Note that
// java.util.Arrays must be imported.)
double[] b=new double[2*items.length];

for(int i=0;i<items.length;i++)
{
b[i]=items[i];
}

items=b;
}
items[top] = N; // Put N in next available spot.
top++; // Number of

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post