Designing a stack interface (HELP!)

Hey guys, Im new to Java and to the forums, and I need desperate help, so I'd appreciate some. I need to design a Stack interface, implementing an ArrayStack class. It should be a ordinary Java array. I also need to write an application demonstrating the use of the stack. The problem is to read a sentence from System.in, using a scanner, and outputting the words of the sentence in reverse order. Here is what Ive been working on for the past few hours.
public interface Stack <c> {
     public boolean isEmpty();
     public void popAll();
     public void push(Object c) throws Exception;
     public void pop() throws Exception;
     public Object peek() throws Exception;
public class ArrayStack <c> implements Stack <c> {
     private Object item [];
     private int top;
     public ArrayStack(int MAX) {
          top = -1;
     @Override
     public boolean isEmpty() {
          return (top == -1);
          // TODO Auto-generated method stub
     @Override
     public void popAll() {
          // TODO Auto-generated method stub
     @SuppressWarnings("unchecked")
     @Override
     public Object peek() throws Exception {
          return item[top];
     @SuppressWarnings("unchecked")
     @Override
     public void pop() throws Exception {
          // TODO Auto-generated method stub
          return item[top--];
     public Object push(Object c) throws Exception {
          item[++top] = c;
          return null;
import java.util.ArrayList;
import java.util.Scanner;
public class UseStack {
     public static void main(String args[]){
          Scanner input = new Scanner(System.in);
// declare and create an ArrayList that will hold String objects
ArrayList<String> wordList = new ArrayList<String>();
while (input.hasNext()) {
String word = input.next();
wordList.add(word);
for (int c = wordList.size() - 1; c >= 0; c--) {
System.out.println(wordList.get(c));
I know its a mess but please help me out and tell me where Im going wrong. Thanks so much

Here is the new thing i got
public interface Stack <c> {
     public void push(char c) throws Exception;
     public char pop() throws Exception;
     public char peek() throws Exception;
     public int size();
     public boolean isEmpty();
public class ArrayStack <c> implements Stack <c> {
     private char [] arrayStack;
     private int top;
     public ArrayStack(int MAX) {
          arrayStack = new char [MAX];
          top = -1;
     public boolean isEmpty() {
          return (top == -1);
     public char peek() throws Exception {
          return arrayStack[top];
     public char pop() throws Exception {
          return arrayStack[top--];
     public void push(char c) throws Exception {
          arrayStack[++top] = c;
          return;
public int size() {
          return 0;
public class UseStack {
     public static void main(String args[]){
     }}

Similar Messages

  • Designing web user interface

    Hi experts,
    can anybody tell me something about designing web user interface, like some of the key considerations? I did not successfully find it on our forum.
    Thanks.

    hi Joey,
    do you mean web template ?
    check
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/749a4622-0a01-0010-36bf-b6b30a2a3a22
    https://www.sdn.sap.com/irj/sdn/docs?rid=/webcontent/uuid/a8cd1f71-0a01-0010-4783-f119b6132d25 [original link is broken]
    http://help.sap.com/saphelp_nw04/helpdata/en/1a/456a3badc1b315e10000000a114084/frameset.htm
    hope this helps.

  • Forms 10g Design Rich User Interface

    Dear All,
    i would link to design rich user interface in forms 10g.
    for example : the button shape is circle , not only
    rectangle.
    Is it possible to do that in forms 10g or import some java object from third party tools.
    best regards
    borisys

    Borisys,
    the concept of Pluggable Java Comnponents (PJC) allows you that. PJC only change the UI of a component without affecting its functionality.
    The Forms demos that are available on otn.oracle.com/products/forms contain enhanced buttons in teh form of mouse over effects.
    Frank

  • Did Lego Design The New Interface?

    Lego no doubt designed the new interface for iOS7. Even has the same plastic feel.

    Hello msharkey,
    You can also check out our sharing and ideas page at http://forums.verizon.com/t5/Share-Your-Ideas-with-Verizon/idb-p/ideas
    Thanks,
    Shamika_VZ
    Verizon Support
    Notice: Content posted by Verizon employees is meant to be informational and does not supersede or change the Verizon Forums User Guidelines or Terms or Service, or your Customer Agreement Terms and Conditions or Plan.

  • Hi there, I couldn't find out on the Adobe site, how much an upgrade to include web commerce through Business catalyst is? (I have a standard design cloud membership. Help pls...:-)

    Hi there, I couldn't find out on the Adobe site, how much an upgrade to include web commerce through Business catalyst is? (I have a standard design cloud membership. Help pls...:-)

    Hi
    You can check the BC pricing here
    US Yearly Pricing | Adobe Business Catalyst

  • SGE2000P Stack Interface Utilization Percentage?

    I'm using a stack of four SGE2000P switches for a PoE video camera system.  I've got the cameras in a VLAN and everything's working fine. 
    I'm wondering, though, is there a way to find out what data rate the stack interfaces are working at (since it's going over cable infrastructure we put in ourselves), and also what percentage of that bandwidth is being used?  I don't see anyway to get to those interfaces from the main page, and
    I wasn't able to find a way to do any sort of percentage thing even on a regular interface.
    Thanks!
    John
    www.controlgeek.net

    Hi John,
    The stacking interfaces are gigabit full duplex.
    I wish there was a easy way, I think the easiest way is to mirror a camera port to the port that your  PC is connected to.  Or use SNMP
    If your just randonly checking the  use of wireshark  is prtetty cost effective. Just look at the wireshark  summary as seen in my screen capture below..
    The statistics within the switch show you all sorts of statistics from packet distributions, CRC etc.. except instananeous data rates per second per port.
    regards Dave

  • Problem with Design Console configuration - please help

    Dear All,
    I am trying to configure design console. It is installed on Windows XP and should point to remote server. I am getting the following error on OIM Server and Port screen:
    INST-07057: Error in validating the Hostname field value. Entered host is not up and running
    Make sure that the host is up and running
    But host is up and running. I can ping it successfully and oim admin interface is working. I suspect this is permission issue.
    If you can help me to resolve this I would appreciate it very much.
    Kind regards
    Maria

    It seems xlclient.cmd got modified. Check if your xlclient.cmd looks like this:
    @echo off
    setlocal
    call classpath
    REM SET DEBUG_OPTS=-classic -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5001 -DXL.RedirectSysOutErrToFile=TRUE -DXL.SysOutErrLogFile=.\logs\Client.System.Out.Err.log
    REM Make sure to remove java.naming.provider.url and read it from the configuration
    REM once the JNDI Profiles are implemented.
    REM make sure you are using j2sdk1.4.2_05
    "<your java home>" %DEBUG_OPTS% ^
         -DXL.ExtendedErrorOptions=TRUE -DXL.HomeDir=C:\Oracle\Middleware\Oracle_IDM1\designconsole ^
         -Djava.security.policy=config\xl.policy ^
         -Dlog4j.configuration=config\log.properties ^
         -Djava.security.manager -Djava.security.auth.login.config=config\authwl.conf ^
         com.thortech.xl.client.base.tcAppWindow -server server
    endlocal

  • Performance issue with XI interfaces - Help Needed

    Hi all,
           We are having idoc->xi->file. We have the design of collecting the idocs as the standard example BpmPatternCollectTime.
            We have given the collection time of say 5minutes after the first idoc hits the BPM process. The issue is that the idoc messages are getting missed when we are sending 1000 idocs. Also after applying the note 898131 for the correction of missing idocs we got the problem of the timeout exception not being triggered and workflow instance is waiting for a longtime until all the messages are getting into BPM and is getting struck in the queue.
            We are into XI 3.0 SP13. Can anyone provide some help in optimizing the interfaces/server settings/etc..
    Thanks in advance.
    Jayakrishnan

    Hi Jayakirshnan,
    check if this helps, whether you have optimal number of dialog processes.
    see theselinks as well
    Re: BPM is slow in sending Idocs
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/sap exchange infrastructure tuning guide xi 3.0.pdf
    http://help.sap.com/saphelp_erp2005/helpdata/en/42/e7bb8f7c9d3ee0e10000000a1553f6/content.htm
    Regards
    Vishnu

  • How to design the user interface for Indesign cs6 plugin ?

    Designing user interface using custom c++ library(SDK) for pluging is very tedious work .so when I search the net than i found that we can do it using Adobe Creative Suite Extension Builder but i dont know how to use it to develop user interface for plugin and to how to enable event handling in this UI .I read lots of document regarding this on net but they all created lots of confusion in my mind  so can anyone help me to know steps which i must follow to develop plugin using this or whatever technology (action script,java script etc)

    If you want to develop Extensions using Creative Suite Extension builder then i think this is not the right forum for you. Please post your specific queries regarding this at the below mentioned link
    http://forums.adobe.com/community/creativesuites/cs_sdk
    To give a brief of how to develop UI using JS you can use ScriptUI to develop your UI, it is a fast and OS independent approach to UI development. The UI created using JS is native in look. You can refer the following link for some help on ScriptUI
    http://www.kahrel.plus.com/indesign/scriptui.html
    I don't have much info regarding development in CS SDK, but i can point you to one more direction of dev called as hybrid plugins wherein the UI is created in CS SDK, and appropriate methods are exposed from the C++ plugin(enhancing the script object model) to be called up by the CS code for too and fro communication between these two modules of code.
    Hope these pointer help you in getting started.
    Thanks,
    -Manan

  • Catalyst 2960-S Stack Interface Packet Drop

    Hi all!
    I have a 2960-S stack with the following behavior:
    SWITCH#sh int g1/0/26
         Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 12275
    When I issue the show mls qos interface g1/0/26 statistics:
    SWITCH#show mls qos interface g1/0/26 statistics
    GigabitEthernet1/0/26 (All statistics are in packets)
      dscp: incoming 
      0 -  4 :    35356866        0            0            0            0 
      5 -  9 :            0            0            0            2            0 
    10 - 14 :           0            0            0            0            0 
    15 - 19 :           0            0            0            0            0 
    20 - 24 :           0            0            0            0            0 
    25 - 29 :           0            0            0            0            0 
    30 - 34 :           0            0            0            0            0 
    35 - 39 :           0            0            0            0            0 
    40 - 44 :      634354        0            0            0            0 
    45 - 49 :           0     49446819      0            0            0 
    50 - 54 :           0            0            0            0            0 
    55 - 59 :           0            0            0            0            0 
    60 - 64 :           0            0            0            0 
      dscp: outgoing
      0 -  4 :     6835883         0            0            0            0 
      5 -  9 :            0             0            0     43973612      0 
    10 - 14 :           0            0            0            0            0 
    15 - 19 :           0            1            0            0            0 
    20 - 24 :           0            0            0            0       204586 
    25 - 29 :           0            0            0            0            0 
    30 - 34 :           0            0            0            0            0 
    35 - 39 :           0            0            0            0            0 
    40 - 44 :           2            0            0            0            0 
    45 - 49 :           0      2215325       0           55            0 
    50 - 54 :           0            0            0            0            0 
    55 - 59 :           0        29668         0            0            0 
    60 - 64 :           0            0            0            0           
      cos: incoming 
      0 -  4 :    35374153            2            0            0            0 
      5 -  7 :    50121685            0            0 
      cos: outgoing
      0 -  4 :    12975602     43973617        85081       204622          122 
      5 -  7 :    47659950          105     34377016 
      output queues enqueued:
    queue:    threshold1   threshold2   threshold3
    queue 0:           0           0    47659935
    queue 1:       92482     1222278    34432039
    queue 2:           0           0    13178400
    queue 3:           0           0    43982889
      output queues dropped:
    queue:    threshold1   threshold2   threshold3
    queue 0:           0           0          71
    queue 1:           0        1738           0
    queue 2:           0           0          20
    queue 3:           0           0      375553
    Policer: Inprofile:            0 OutofProfile:            0
    I need some help to read this output but it seems that packets are dropped at all queues, isn't it?
    Any help please?
    Thanks in advance!

    Please post the output to the following commands:
    1.  sh interface G1/0/26; and
    2.  sh controll e G1/0/26
    What kind of client is connected to port Gi1/0/26?

  • Newbie question on report design for multiple pages - HELP!

    I am upgrading an existing accounting program to use Crystal reports. The accounting program generates account statements for our investors. Each account needs to have 1 statement (which typically is only 1 page long).
    I have a table that has 1 record per activity per account. Every account has a unique code and the report is set to group records by this code. Therefore, an account can have 1+ records associated with it that need to be displayed in the details section.
    To test my report I have 4 records in my table -- 2 records for account code 'ABCD' and 2 records for account code 'WXYZ'. The report correctly groups  the records together and summarizes the necessary information, but it DOES NOT create a page break.
    I don't understand what else I need to do in the designer to force it to create a new page everytime the account code changes... It's basically a mail-merge type functionality that I am looking for!
    Any help is appreciated.
    SG

    In the gray section to the left of the report design, right-click on the group footer for the Account Code and select 'Section Expert'.  Turn on "New Page After".  To prevent a blank page at the end of your report, click on the formula button to the right of the check-box and enter "not OnLastRecord".
    -Dell
    - A computer only does what you told it to, not what you <em>thought</em> you told it to!

  • Stacked chart help in apex 4.0

    Hi All,
    I am working on a stacked chart.below is the query
    select  null link,range label,count(total) value1,Dept value2 from
    (select '0-10' as range,count(emp_id) total,Dept from table
    group by Dept
    union all
    select '10-20' as range,count(emp_id) total,Dept from table
    group by Dept
    select '20-30' as range,count(emp_id) total,Dept from table
    group by Dept
    union all
    select '30-40' as range,count(emp_id) total,Dept from table
    group by Dept)
    i need to display the count of employee id in each department as  a stacked series. Can anyone please help me to how to get this
    Regards
    Ark

    Sorry. I just realized that I was logged-in as a "developer" not as the APEX Admin which, of course, is why I couldn't find the "security" option. I had too many windows open at once.
    Elie

  • Stack class help

    hi i was wondering if anyone could help me, i keep getting 2 errors on the pop and push methods sayin it cannot find the variable.
    package labwork1;
    import java.util.*;
    * @author me
    public class Main
        public Main() {
        public static void main(String[] args)
          Stack stk = new Stack();
        public void help(String object)
            if(object.startsWith("-")){
                stk.pop();
            else{
                   stk.push(object);
    }

    ok i get that the scope of the stack is only in the
    main method, how would i solve this, so that the push
    and pop methods will work?Not sure what you are doing but:
    Declare it in the class as an instance variable.

  • Will an audio interface help?

    I'm looking to get started with GB using my Yamaha Clavinova. I've managed to get the keyboard connected through its built in USB midi interface, but when playing software instruments there seems to be a limitation on how fast, and how many keys I can play simultaneously. Too many or too fast, and the sound drops out.
    I've started looking at audio interfaces like the M-Audio Fast Track Pro, but I'm not sure if it will help me much with midi. I'm not as interested in recording live instruments or vocals although I may in the future. My main desire is to use the software instruments.

    Hi,
    Blizzard going on hear wow,
    I was reading just today (and thought it was about M-Audio) but the company-info =
    http://www.esi-audio.com/aboutus/technology/ (its about their Driver Technology called=
    EWDM - Enhanced Audio MIDI Driver
    Home Page (and they do have a USA supplier as well as other Countries)
    http://www.esi-audio.com/
    they had 4 MIDI interfaces including
    http://www.esi-audio.com/products/midimate2/
    info-
    MIDIMATE II is a convenient USB 2.0 MIDI interface cable with up to 32 input or 32 output channels for PC and Macintosh systems. With MIDIMATE II you can obtain perfect MIDI timing and performance at an extremly affordable price. The interface cable is compatible with Windows XP, Windows 7 (32/64bit) and Windows Vista (32/64bit) as well as Mac OS X and instantly works after you plug it in - no driver installation is required. There is more, MIDIMATE II even automatically detects the incoming and outgoing MIDI signals, which means that both connectors work as input or output. You can use as 1 simultaneous input and 1 simultaneous output (with 16 channels each), 2 input (32 channels) or 2 output (32 channel) device.
    Features
    USB MIDI interface with 2 MIDI connectors, each can work as independent input or output
    high-speed connection to USB 2.0 or 1.1 equipped PC or Macintosh system
    bus powered, requires no external power supply
    no driver needed for Windows XP, Windows Vista, Windows 7 and Mac OS X
    Here is the Company's Product List link=
    http://www.esi-audio.com/products/
    and Distributors
    http://www.esi-audio.com/aboutus/distributors/
    They even have Home Entertainment Set-up-Configuration Devices
    as well as Audio Interfaces (but if You desire to get MIDI IN direct a Audio Interface wether
    USB-Firewire, would have potentially a lot of ins and outs that You appear not to need (or may down the road) Its Your Gear and Set-up
    Hope this Helps
    (I could not get over (some) resemblance to M-Audio Products (correct me if I am wrong)
    ambienttales

  • Interface help needed (Edirol FA-66) - works with Tiger, not Leopard

    I have an Edirol FA66 that works fine on my Macbook running Tiger, but doesn't show up as a device on my iMac running Leopard. Can anyone help please? Thanks....

    I used Edirol FA-66 interface successfully with my Intel iMac using Tiger & Logic, iTunes etc for a year, and it worked great. I upgraded from 10.4.4 to 10.4.11 when the system wouldn't recognize M-Audio Radium keyboard. After the upgrade keyboard is on board but now FA-66 doesn't work at all, crackles, static, no sound or device recognition. Must be some glitch in 10.4.11..? Downgraded and the keyboard is gone. Upgraded and the interface is gone. Crazy!
    If I buy Leopard, will it resolve both?? I don't want to get Leopard and weigh down my system with all the stuff that goes with it and have the Edirol stuck in the same situation. Is there anyone out there who has experienced this and can recommend a particular version of Leopard?
    Thank you
    Mara

Maybe you are looking for