for my project I have problem in report

Posted by pink rose on Stack Overflow See other posts from Stack Overflow or by pink rose
Published on 2010-05-30T18:51:38Z Indexed on 2010/05/30 19:02 UTC
Read the original article Hit count: 573

Filed under:
public class stack
{
    private int Array[];
    private int top = -1;
    public int size;

    public stack(int size)
    {
        this.size=size;
        Array = new int[size];
    }

    public void push(int j)
    {
        if (top < size)
        {
            Array[++top] = j;
        }
    }

    public int pop()
    {
        return Array[top--];
    }

    public int top()
    {
        return Array[top];
    }

    public boolean isEmpty()
    {
        return (top == -1);
    }
}
import javax.swing.JOptionPane;
public class menu
{
    private static stack s;
    private static int numbers[];

    public static void main(String args[])
    {
        start();
    }

    public static void start()
    {
        int i = Integer.parseInt(JOptionPane.showInputDialog("1. size of array\n2. data entry\n3. display content\n4. exit"));
        switch (i)
        {
            case 1:
                setSize();
                break;
            case 2:
                addElement();
                break;
            case 3:
                showElements();
                break;
            case 4:
                exit();
        }
    }

    public static void setSize()
    {
        int size = Integer.parseInt(JOptionPane.showInputDialog("Please Enter The Size"));
        s = new stack(size);
        numbers = new int[10];
        start();
    }

    public static void addElement()
    {
        for(int x=0;x<s.size;x++)
        {
            int e = Integer.parseInt(JOptionPane.showInputDialog("Please Enter The Element"));
            numbers[e]++;
            s.push(e);
        }
        start();
    }

    public static void showElements()
    {
        String result = "";
        int temp;
        while (!s.isEmpty())
        {
            temp = s.pop();
            if (numbers[temp] == 1)
            {
                result = temp+result;
            }
        }
        JOptionPane.showMessageDialog(null, result);
        start();
    }

    public static void exit()
    {
        System.exit(0);
    }
}

This my project I was finished but I have problem in question in my report

Conclusion. It should summarize the state of your project and indicate which part of your project is working and which part is not working or with limitations. You may also provide your suggestions and comments to this project

what I can answer I didn't have any idea

© Stack Overflow or respective owner

for my project I have problem in report

Posted by pink rose on Stack Overflow See other posts from Stack Overflow or by pink rose
Published on 2010-05-30T19:12:43Z Indexed on 2010/05/30 19:22 UTC
Read the original article Hit count: 573

Filed under:
|
|
public stack(int size) 
{ 
    this.size=size; 
    Array = new int[size]; 
} 

public void push(int j) 
{ 
    if (top < size) 
    { 
        Array[++top] = j; 
    } 
} 

public int pop() 
{ 
    return Array[top--]; 
} 

public int top() 
{ 
    return Array[top]; 
} 

public boolean isEmpty() 
{ 
    return (top == -1); 
} 
}

import javax.swing.JOptionPane; public class menu { private static stack s; private static int numbers[];

public static void main(String args[]) 
{ 
    start(); 
} 

public static void start() 
{ 
    int i = Integer.parseInt(JOptionPane.showInputDialog("1. size of array\n2. data entry\n3. display content\n4. exit")); 
    switch (i) 
    { 
        case 1: 
            setSize(); 
            break; 
        case 2: 
            addElement(); 
            break; 
        case 3: 
            showElements(); 
            break; 
        case 4: 
            exit(); 
    } 
} 

public static void setSize() 
{ 
    int size = Integer.parseInt(JOptionPane.showInputDialog("Please Enter The Size")); 
    s = new stack(size); 
    numbers = new int[10]; 
    start(); 
} 

public static void addElement() 
{ 
    for(int x=0;x<s.size;x++) 
    { 
        int e = Integer.parseInt(JOptionPane.showInputDialog("Please Enter The Element")); 
        numbers[e]++; 
        s.push(e); 
    } 
    start(); 
} 

public static void showElements() 
{ 
    String result = ""; 
    int temp; 
    while (!s.isEmpty()) 
    { 
        temp = s.pop(); 
        if (numbers[temp] == 1) 
        { 
            result = temp+result; 
        } 
    } 
    JOptionPane.showMessageDialog(null, result); 
    start(); 
} 

public static void exit() 
{ 
    System.exit(0); 
} 
}

This my project I was finished but I have problem in question in my report

Conclusion. It should summarize the state of your project and indicate which part of your project is working and which part is not working or with limitations. You may also provide your suggestions and comments to this project

what I can answer I didn't have any idea

© Stack Overflow or respective owner

Related posts about fluent-nhibernate