Results 1 to 8 of 8

Thread: Array help

  1. #1
    eummm's Avatar
    eummm is offline Member
    Join Date
    Nov 2010
    Location
    Europe
    Posts
    4
    Rep Power
    0

    Smile Array help

    Can any one help me plz
    for school i have to make the following program with arrays command-line argument
    The program must ask me the number of days and show me the date as result
    This is the result of the program as shown under
    tnx every one
    __________________________________
    java Days 123
    day 123 is 3 May

    java Days 365
    day 365 is 31 December
    java Days 1
    Day 1 is 1 january

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

    Default

    Quote Originally Posted by eummm View Post
    for school i have to make the following program with arrays command-line argument
    The program must ask me the number of days and show me the date as result
    This is the result of the program as shown under
    tnx every one
    __________________________________
    java Days 123
    day 123 is 3 May

    java Days 365
    day 365 is 31 December
    java Days 1
    Day 1 is 1 january
    Hello, and welcome to the forum.

    So in essence what you've done is to give us your entire assignment without asking a question and without showing any evidence of effort on your part, and I'm afraid that in this situation there's not much that we can do for you other than to direct you to a tutorial or two.

    I suggest that you post your best solution that you've created so far, and ask as specific questions as possible, and we'll be much better able to help. If you really have no idea how to begin here, then please have a look here: Starting Writing a Program. It's a well-written article that can help.

    Much luck

  3. #3
    eummm's Avatar
    eummm is offline Member
    Join Date
    Nov 2010
    Location
    Europe
    Posts
    4
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    Hello, and welcome to the forum.

    So in essence what you've done is to give us your entire assignment without asking a question and without showing any evidence of effort on your part, and I'm afraid that in this situation there's not much that we can do for you other than to direct you to a tutorial or two.

    I suggest that you post your best solution that you've created so far, and ask as specific questions as possible, and we'll be much better able to help. If you really have no idea how to begin here, then please have a look here: Starting Writing a Program. It's a well-written article that can help.

    Much luck
    Tnx alot Fubarable
    HERE is the program i have written so far, and further have no idea


    public class Dagen{
    public static void main (String arg []){
    if (arg.length < 1){
    System.out.println("Aantal argument is fout!");
    }


    else {
    int DAG_MAAND [] = {31,28,31,30,31,30,31,31,30,31,30,31};
    int sum = 365 - ;
    String MAAND [] = {"januari", "februari", "maart", "april", "mei", "juni", "juli","augustus", "september", "oktober", "november", "december"};
    System.out.println(MAAND[Integer.parseInt(arg[0])]);




    }
    }
    }

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    So...what happens when you run that?

  5. #5
    eummm's Avatar
    eummm is offline Member
    Join Date
    Nov 2010
    Location
    Europe
    Posts
    4
    Rep Power
    0

    Default

    Quote Originally Posted by Tolls View Post
    So...what happens when you run that?
    IF i run it now then it ask me the number of array
    when i type for example

    java Dagen 5
    the out put will be:
    May

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    ?
    Does it throw an exception or what?

  7. #7
    venerik is offline Member
    Join Date
    Oct 2010
    Posts
    94
    Rep Power
    0

    Default

    I'd do something like:

    Check whether 'number of days' is greater than 'number of days in first month' if so decrease 'number of days' by 'number of day of first month' and repeat with next month. If not print "'number of days' is 'number of days' 'first month'"

    Hm, a little cryptic but you can do some thinking as well I guess. :)

    Erik
    I'm new to Java but I like to help where ever I can. :)

  8. #8
    eummm's Avatar
    eummm is offline Member
    Join Date
    Nov 2010
    Location
    Europe
    Posts
    4
    Rep Power
    0

    Default

    Quote Originally Posted by venerik View Post
    I'd do something like:

    Check whether 'number of days' is greater than 'number of days in first month' if so decrease 'number of days' by 'number of day of first month' and repeat with next month. If not print "'number of days' is 'number of days' 'first month'"

    Hm, a little cryptic but you can do some thinking as well I guess. :)

    Erik
    well tnx alot buddy i will try my level best and let u know wat happens have fun

Similar Threads

  1. Replies: 23
    Last Post: 09-07-2010, 09:12 PM
  2. Replies: 2
    Last Post: 09-06-2010, 02:03 AM
  3. Convert Char Array to String Array
    By Mayur in forum New To Java
    Replies: 8
    Last Post: 10-12-2009, 12:41 PM
  4. Array length and printing out uninitialized array.
    By nicolek808 in forum New To Java
    Replies: 4
    Last Post: 09-10-2009, 10:12 AM
  5. Replies: 1
    Last Post: 03-31-2009, 07:40 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
  •