PLease i need a helping hand

Please could someone help me with the following code to check if a stack is empty or not.
i have written this code button it doesnt correctly identify when a stack is empty or not.
N.b I can not use any java built in classes or methods to check. I have been given a node class to use and i need to return true if the stack is empty or false if there is something in there.
Many Thanks for any help
Heres the code:
public boolean isEmpty() {
if((top.next==null && top.data==null) || top.data==""){
return true;
else{
return false;
}

levi from your code i have extracted the parts that i need here is my final code:
public class Question2 {
private Node top;
private Question1 check;
/* You NEED to IMPLEMENT a constructor with NO arguments. This */
/* constructor should initialize this class. */
public Question2() {
top = null;
/* This method pushes a ZML start tag onto the top of the stack. */
public void pushTag(String startTag) throws TagError {
top = new Node(startTag, top);
} // end of metod pushTag
/* This methods pops a ZML start tag of the top of the stack. Should */
/* the stack be empty, then the exception "StackEmpty" is thrown. */
public String popTag() throws StackEmpty { 
return top.data;
} // end of method popTag
/* This method returns "true" if the stack is empty, otherwise it */
/* returns "false". */
public boolean isEmpty() {
return top == null;
} // end of method isEmpty
} // end of class Question2
in the poptag method it is only a string return value, so would i have to run a loop or something which moves all the nodes up one place, and if this code was placed after the return value would it not get executed
Many Thanks for any help anyone can offer

Similar Messages

  • I want to get iBook, Facebook and Skype to my iphone 4.2.1 through my iTune, but I coudn't because it is said that it requires a newer version of iOS. Please I need your help. Thanks

    I want to get iBook, Facebook and Skype to my iphone 4.2.1 through my iTune, but I coudn't because it is said that it requires a newer version of iOS. Please I need your help. Thanks

    If your iPhone can't be updated to a higher iOS version then the only way to get them is if you downloaded versions of them which were compatible with iOS 4.2.1 and you still have copies of those versions somewhere e.g. on your computer or on a backup - only the current version of each app is available in the store, and as apps (and other content) are tied to the account that downloads them, you will need to have older copies that are linked to your id

  • HT4759 Please I need a help I cannot backup my ipad and can not get into the icloud storage.  What would I do to get into my ipad?  please I need your help

    Please I need a help.  I cannot backup my ipad and can not get into the iclous storage to delet them, because its read icloud storage is full.  Please do you have a knowledge of how I can get rid of the message and get into the ipad?

    Welcome to the Apple Community.
    You might try a forced shutdown to begin with, hold down the top and home buttons together until the device shuts down, then restart it.

  • Hi, my iphone its in recovery mode and when i restore my iphone 5s loading show the blue screen and show note on itunes (unknown error 14) please i need your help please . thanks

    Hi, my iphone its in recovery mode and when i restore my iphone 5s loading show the blue screen and show note on itunes (unknown error 14) please i need your help please . thanks

    In the article Resolve iOS update and restore errors this is what it says about error 14:
    Check your USB connections
    Related errors: 13, 14, 1600, 1601, 1602, 1603, 1604, 1611, 1643-1650, 2000, 2001, 2002, 2005, 2006, 2009, 4005, 4013, 4014, or “invalid response."
    If the USB connection between your device and computer is interrupted, you may be unable to update or restore.
    To narrow down the issue, you can also change up your hardware:
    Use the USB cable that came with your device, or a different Apple USB cable.
    Plug your cable into a different USB port directly on your computer. Don't plug it into your keyboard.
    Try a different computer.
    If necessary, resolve any further issues with the USB connection, then with your security software.
    If you're still seeing the error message, check for hardware issues by following the next section.

  • HT5625 please i need a help, a cant afford to buy new iphone, i bought pairly used in the market here in khartoum Sudan, mistakenly i reset it where i realised that i cannot use it again because it was linked to an apple id, and i dont know the person.

    please i need a help about how to use my iphone again, i bought pairly used, mistakenly i reset it and then i realised that it was linked to another persons id and password which i dont know or how to contact the person, and still i cant evan see the full email adress of the person which i think i could have contact him directly. so does that means i can no more longer use the phone again? please i need help, am a student from khartoum sudan.

    profuhassan wrote:
    please i need a help about how to use my iphone again, i bought pairly used, mistakenly i reset it and then i realised that it was linked to another persons id and password which i dont know or how to contact the person, and still i cant evan see the full email adress of the person which i think i could have contact him directly. so does that means i can no more longer use the phone again? please i need help, am a student from khartoum sudan.
    That is correct, you now have a paperweight.  Unless you can get a hold of the orignal owner.

  • HT201210 please,I need your help ! I was updating my iphone ios to ios4.2 and then problems begins when it shows that it needs to restore the factory software to I was trying to restore ,but that didn't happen it begins but then it shows unknown error 101

    please,I need your help ! I was updating my iphone ios to ios4.2 and then problems begins when it shows that it needs to restore the factory software to I was trying to restore ,but that didn't happen it begins restoring but then it shows unknown error 1015

    Stop being impatient.
    From the article that the question was posted from:
    Errors related to downgrading iOS
    The required resource cannot be found: This alert message occurs when your device has a newer version of iOS than what is available in iTunes. When troubleshooting a device that presents this alert message, go to Settings > General > About and check the version of iOS on the device. If it is newer than the latest released iOS version, the device may have a prerelease developer version of iOS installed.   Installing an older version of iOS over a newer version is not supported.
    Error 1015: This error is typically caused by attempts to downgrade the iPhone, iPad, or iPod touch's software. This can occur when you attempt to restore using an older .ipsw file. Downgrading to a previous version is not supported. To resolve this issue, attempt to restore with the latest iPhone, iPad, or iPod touch software available from Apple. This error can also occur when an unauthorized modification of the iOS has occurred and you are now trying to restore to an authorized, default state.
    You cannot downgrade.
    If you have a 3GS, you can only install iOS 6.1.3 which is the current version of iOS for the device.

  • This website make problem for me, he open by it self everytime i try to open another websites  Please i need some help

    this website make problem for me, he open by it self everytime i try to open another websites
    Please i need some help
    http://yandex.ru/yandsearch?text=ццц&lr=1004

    Dude, I don't think there's a user on this forum that would click on that link.

  • Hi, Someone Know why my charger is not working properly but always it was been working good but now when conect my iphone (3gs) shows a yellow triangle saying : Charging is not supported with this accessory. Please I need some help here. Thanks =D

    Hi Someone Know why my charger is not working properly but always it was been working good but now when conect my iphone (3gs) appears a golden triangle saying :Charging is not Supported with this accessory. Please I Need Some Help Here. Thanks =D

    sounds like the cable or the iphone connector are somehow damaged

  • Please i need a help in updating my nokia 5800

    Hello everybody
    please I need a help
    when i am updating my nokia in to v40 from v21 using nokia update software it begins downloading but when it reaches 20 mb it returns a lot of times at last it said you have a low internet connectivity
    otherwise when i enter *#0000# and check for updates they said no updates are found
    what is the solution of my problems I have still try updating for more than 5  days but nothing has been changed.
    Can a body upload the update in others serves espically in mediafire sinnce mediafire is the best site for me to download from? please I need the update since my nokia now is slow and after update it will have new things and ofcourse will be speed up.
    please can anyone upload it using www.mediafire.com and thanks so much
    I want it quickly, and only mediafire for downloading working on my bad internet connectivity

    For performing a firmware update you need an high speed internet connection i dont know whats the speed of internet connection you are using, in this case you can go to nokia care point and get it updated. Thats safe and you won't brick your phone too. Firmware updates can be done only through nokia software updater application and through the phone(fota)by the end user and there is no way to put the update file to some place or server like what you asked for.
    If a reply has solved your problem click Accept as solution button, doing it will help others know the solution. Thanks.

  • Help please am useing an Iphone 3gs after i restore the iOS device restart my phone can not Activate it.. what do i do please i need your help.?

    Help please am useing an Iphone 3gs after i restore the iOS device restart my phone can not Activate it.. what do i do please i need your help.?

    Usually indicitive of a phone that's been jailbroken or hacked to unlock it, something of which you will net get support for here.

  • Please , i need youre help ! im from Mexico and i dont speak inglish well but ill try explain me... i buy a cs5 students edicion but i lost my paswoord for the instalacion can you helpe me ? how can i recuperade my paswoord

    please , i need youre help ! im from Mexico and i dont speak inglish well but ill try explain me... i buy a cs5 students edicion but i lost my paswoord for the instalacion can you helpe me ? how can i recuperade my paswoord
    Creative Suites

    Find your serial number quickly
    Mylenium

  • HI ALL SINCE TWO DAYS I AM DOWNLOADING VIBER BUT I AM NOT HAVING MY ACCESS CODE AND EVERY TIME I DELETE THE APPLICATION AND DOWNLOADING IT AGAIN BUT ALWAYS THE SAME RESULT PLEASE I NEED YOUR HELP FOR THE ACCESS CODE.MY PHONE NUMBER IS 0022996969896.THANKS

    HI ALL SINCE TWO DAYS I AM DOWNLOADING VIBER BUT I AM NOT HAVING MY ACCESS CODE AND EVERY TIME I DELETE THE APPLICATION AND DOWNLOADING IT AGAIN BUT ALWAYS THE SAME RESULT PLEASE I NEED YOUR HELP FOR THE ACCESS CODE.MY PHONE NUMBER IS 0022996969896.THANKS IN ADVANCE

    try this website this should help you http://helpme.viber.com/index.php?/Knowledgebase/List/Index/1/iphone

  • Hey guys i please i need a help on my ipad. i have received an ipad from anonymous person but she has already logged in to iclouds, since i dont know her password how do i sign out without using password on ios 8?

    Hey guys i please i need a help on my ipad. i have received an ipad from anonymous person but she has already logged in to iclouds, since i dont know her password how do i sign out without using her password on ios 8?

    You can't. Your mysterious benefactor must remove the device from her (I guess you know it's a her?) iCloud account by logging into icloud.com, going to Find my iPhone and removing from there.
    Matt

  • How to get app.processId from Guided Procedures? Please I need You help

    Hi everyone, I need your help, I need to recover the processId once time the Procees was started in Guided Procedures
    I found this link from maintenance process in Guided Porcedures administration
    http://host:port/webdynpro/dispatcher/sap.com/cafeugpui~rt/Runtime?app.processId=IDnumber
    the parameter I need is IDnumber, I dont know if it is possible with web dynpros or with web services please I need you help
    How Can I do this?
    Thank you very much my friends
    Regards from Mexico
    Atte Israel

    Hi,
    I am not sure about the version. But you can follow the steps below.
    1. Create a Web Dynpro Poroject (Ideally create a DC , but if you don't have NWDI setup a project will do).
    2. Add reference to com.sap.security.api.jar and sap.comcafeugpapi.jar
    3. Under WebDynpro References -> Library References add sap.com/cafeugp~api
    4. Put following code in wdDoInit()
    public void wdDoInit()
        //@@begin wdDoInit()
         IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();
         IWDMessageManager msgMgr= wdComponentAPI.getMessageManager();
         try{
         IWDClientUser wdUser = WDClientUser.getCurrentUser();
         IUser user = wdUser.getSAPUser();
         IGPUserContext userContext = GPContextFactory.getContextManager().createUserContext(user);
         Date startDate = new Date(110,1,1); // Start date as 01-Jan-2010
         Date endDate= new Date(111,12,31); // End date as 31-Dec-2011
         IGPProcessInstanceInfo[] array = rtm.getRunningInstances(GPSearchRole.SEARCH_ROLE_OWNER, startDate, endDate, userContext);
         for (int i=0; i<array.length; i++){
         String instanceId = array<i>.getProcessInstanceID();
    //        Write logic to pass the instance ID to the RFC
    msgMgr.reportSuccess("Instance id =" + instanceId);
         catch(Exception ex)
         msgMgr.reportException(ex.getLocalizedMessage(),false);     
        //@@end
    Let me know if you face any issues.
    Thanks
    Prashant

  • HT4097 please my ipad in recovery mode after last update and i tried the previous steps and it is same condition in recovery mode please i need your help

    please i need your help i made update to my ipad to the last version then i find it in recovery mode and tried to restore it using i tunes but it the same in recovery mode please i need your help to solve this problem

    If you followed these instructions and you were unable to enter recovery mode, I'm still leaning toward a hardware problem.  Also, since you have IOS-7, read this.  It might help.

Maybe you are looking for

  • Is there a way of adjusting WEEKNUMs to match a financial year?

    Hi I am wondering if there is a way to have Numbers 09 adjust the WEEKNUMs so that they match the financial year, starting in the first week of April (UK). Given that I will have to do tax returns which match the financial year, it makes sense to mat

  • How can I add an image to my pop up text box built in Fireworks?

    Hello all, I have already built my page (a map) with all the pop up text boxes in Fireworks and imported them into my Dreamweaver page, but I would like to add an image in that same pop up box as well as the text. I tried going back to Fireworks and

  • xsl:template match="UL/LI|ul/li" has extra space line

    <xsl:template match="UL/LI|ul/li"> <fo:list-item> <fo:list-item-label end-indent="label-end()"> <fo:block>•</fo:block> </fo:list-item-label> <fo:list-item-body start-indent="body-start()"> <fo:block> <xsl:apply-templates select="*|text()"/> </fo:bloc

  • No Button in a specific JSP page fires event..

    hi I desperately need help in following thing. I wanted to sort a datatable by command links in headers but those were not firing events so i used teh buttons instead. They kept on working fine but now something weird has happened. Neither the button

  • SMARTFORMS AGAIN!!

    I HAVE CREATED A SMARTFORM WITH FORM N CODE SEPARATELY IN THE PRINT PROGRAM.I HAV TAKEN A TABLE N POPULATED IT WITH THE DATA IN THE PRINT PROGRAM(PP).AND I HAV DECLARED THAT TABLE IN THE TABLE INTERFACE IN THE FORM.WHEN I CALL THE FIELD FROM THE TABL