Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   Can somebody help me with Java code? (https://www.askmehelpdesk.com/showthread.php?t=766820)

  • Sep 12, 2013, 12:49 AM
    Ann111111
    Can somebody help me with Java code?
    A method called dropItems() taking a Robot and an integer. The robot should (try
    to) drop that number of items.
    My version doesn't work unfortunately. Here is it:

    int dropBeepers(String input, int createRobot, int count) {
    count =0;


    while(isRobotCarryingItems()) {
    dropItemFromRobot();
    }
    count++;
    return(count);
    }
    }
  • Sep 14, 2013, 06:22 PM
    Pelusawoman
    Well, one problem is that count is coming in with a value, yes? Then you zero it, and if all goes well, you increment it to "1" and send it back. Is this really what you want to do?

  • All times are GMT -7. The time now is 08:27 AM.