Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By Junky

Thread: Need help with a task

  1. #1
    forever_lona is offline Member
    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0

    Default Need help with a task

    Hi all

    I am very new to Java, and am studying it in my first year of uni.

    I have been unwell and missed much of the middle part of the semester, and while I have tried to catch up, I am strugging with several basic concepts.

    I have an assignment in which I am required to have a program output the date of someones birth, in the form of : You were born on 1 January 1987.

    The user is required to input their date of birth in a single string, using several possible formats, including dd/mm/yy, dd.january.yyyy, dd-jan-yy.

    I feel from this that I am supposed to make use of the sc.nextInt or sc.nextString processes, but I am struggling to implement them correctly.

    While I can work out the math simply enough to ccalculate the date, I am struggling with how to implement these also. I know I should declare an int array for the days of the month, and I want to declare another for the month that will change the different possible input months into a full month name.

    Honestly, I'm completely lost here, and my lecturer has been no help in trying to understand - he's simply not interested in the course.

    Any help, at all, would be extremely appreciated at this stage.

    Thanks guys.

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default Re: Need help with a task

    <harsh>
    Your problems are yours not ours. Posting them here does not guarantee you better help or sooner.

    Do not blame your teacher. Have you tried approaching them with a specific question or simply said "I don't know what to do"?
    </harsh>

    <nice>
    The best way to get help here is to attempt writing the code. When you encounter a problem then post the code here (use code tags) and ask a specific question. "It doesn't work" is not specific.

    You can read the input using Scanner.nextLine(). Then break the String up using String.split(). Once you have the separate bits of information work out how you can convert a month of 1 to January.
    </nice>
    gimbal2 likes this.

  3. #3
    forever_lona is offline Member
    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0

    Default Re: Need help with a task

    Quote Originally Posted by Junky View Post
    <harsh>
    Your problems are yours not ours. Posting them here does not guarantee you better help or sooner.

    Do not blame your teacher. Have you tried approaching them with a specific question or simply said "I don't know what to do"?
    </harsh>
    Dont get me wrong, I dont expect any better help, nor am I blaming the teacher. Simply pre-answering any "Why dont you ask the teacher" or "Why didnt you go to class" questions, I dont want to waste anyones time any more than I have already ;)

    <nice>
    The best way to get help here is to attempt writing the code. When you encounter a problem then post the code here (use code tags) and ask a specific question. "It doesn't work" is not specific.

    You can read the input using Scanner.nextLine(). Then break the String up using String.split(). Once you have the separate bits of information work out how you can convert a month of 1 to January.
    </nice>
    Thanks. String.split() should help immensely. I'll spend some time working on it over the weekend and if I encounter any issues I'll post back here with the code.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Need help with a task

    Quote Originally Posted by forever_lona View Post
    Need help with a task
    Please go through the Forum Rules, especially the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Posts
    356
    Rep Power
    5

    Default Re: Need help with a task

    Take it one step at a time. In order to have a functioning JAVA program, at the least, you need a class that contains the main() method. Have you gotten that far?

Similar Threads

  1. ant run-task
    By JSE.DUB in forum Lucene
    Replies: 0
    Last Post: 08-21-2013, 12:01 PM
  2. Neeh help in task please
    By kumar_ravi in forum New To Java
    Replies: 12
    Last Post: 08-01-2012, 04:17 PM
  3. task
    By boys21 in forum Advanced Java
    Replies: 6
    Last Post: 05-28-2010, 01:59 PM
  4. Help with a task.
    By checho in forum New To Java
    Replies: 5
    Last Post: 01-14-2010, 11:29 AM
  5. Get Paid to do this task!
    By Zass101 in forum New To Java
    Replies: 14
    Last Post: 04-21-2009, 05:44 AM

Posting Permissions

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