Results 1 to 20 of 20
  1. #1
    thendnboi Guest

    Question "Numbers Up and Down"

    <homework dump deleted>
    Last edited by Fubarable; 05-06-2011 at 02:44 AM.

  2. #2
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    7

    Default

    So what would you like us to do?

  3. #3
    thendnboi Guest

    Default

    I would greatly appreciate if you could give me sample code that works AND explain how/why it works. Again, I am new to java.

  4. #4
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    What have you done so far? I suggest you break this program up into smaller pieces. First you should create two methods, one which tests if a number is an up number, and one which tests for down numbers.

    After that it should be fairly easy to create 2 loops, test if the number fits the right criteria, if it does, print it.

    We don't give you the code, we let you figure it out. If you post code use code tags
    [code]
    YOUR CODE HERE
    [/code]

    Also, ask specific questions.

  5. #5
    thendnboi Guest

    Default

    Ok, this is my first week in java, I need help! I don't have any ideas besides a while loop.

  6. #6
    thendnboi Guest

    Default

    Help?!?!?!?!?!?!?!

  7. #7
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    That is going to get you the exact opposite of help.

    Try making a method to identify if a number is an up number.

  8. #8
    thendnboi Guest

    Default

    I am new to java!!! I don't know what that stuff is! Can you send me code and help me by explaining it!!!!

  9. #9
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    I'll give you some pseudo code
    Java Code:
    public boolean isUpNumber(int num){
      create array
      loop
        split number with % and /, store in array
      end loop
      loop 
        make sure each number is greater than the previous
        if not, return false
      end loop
      return true
    }

  10. #10
    thendnboi Guest

    Default

    That doesnt help at all!

  11. #11
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    I'm here to help you, but not do it for you. You still have not really tried anything or asked any specific questions. What don't your understand about methods which determine whether the number is up or down?

  12. #12
    thendnboi Guest

    Default

    My specific question is can you please give me the full code? THANKS

  13. #13
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    My specific answer is no, do your own homework.

  14. #14
    thendnboi Guest

    Default

    I HATE YOU! Help me! NOW

  15. #15
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Lol, ok, here is your code, since you asked so politely
    Java Code:
    public class X{
      public static void main(String[] args){
        char[] answer = { 68, 111, 32, 121, 111, 117, 114,
                   32, 111, 119, 110, 32, 104, 111, 109, 101, 119,
                   111, 114, 107 };
        for(int j = 0; j < answer.length; ++j){
          System.out.print(answer[j]);
        }
        System.out.println();
      }
    }

  16. #16
    thendnboi Guest

    Default

    I am serious help me....

  17. #17
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    I did, did you at least run that?

  18. #18
    thendnboi Guest

    Default

    Yes i ran it it said "Do your own homework"

  19. #19
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  20. #20
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 3
    Last Post: 10-12-2010, 05:21 PM
  2. Replies: 1
    Last Post: 01-21-2010, 10:20 AM
  3. problem with argument list and precedence "(" and ")"
    By helpisontheway in forum Advanced Java
    Replies: 6
    Last Post: 12-24-2009, 08:50 AM
  4. Replies: 2
    Last Post: 01-24-2009, 07:56 PM
  5. Replies: 1
    Last Post: 10-20-2008, 08:35 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •