Results 1 to 7 of 7

Thread: sign finder

  1. #1
    iPetey is offline Member
    Join Date
    Apr 2009
    Posts
    11
    Rep Power
    0

    Default sign finder

    i'm having trouble trying to figure out how i should implement code. i have an assignment for school and i seemed to have figured out 2/3 of it. the last part is to make a program that would allow a user to input their birthday and it would display the persons astrological sign. i am stuck on how i could do this in java. im thinking an arraylist would be ideal, and i would search it, but i'm still stuck. does anyone have an idea on how i could approach this? thank you in advance for your thoughs/opinions.

  2. #2
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    western(Aries,Taurus,...) or eastern(chick, pig, dog, ...) ?
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  3. #3
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Surely just a 12-case if statement? Use an enum to represent the possible results.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  4. #4
    iPetey is offline Member
    Join Date
    Apr 2009
    Posts
    11
    Rep Power
    0

    Default

    western! orange dog, i am using scanner class and it will ask the user what their bday is and then display it if that makes any difference. im not sure how i could use case if for that because of the difference in dates.

  5. #5
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Use DateFormat to parse the date and return which day of the year it is. Then
    Java Code:
    if (day > 355 || day < 21) sign = CAPRICORN;
    else if (day < 51) sign = AQUARIUS;
    ...etc
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  6. #6
    iPetey is offline Member
    Join Date
    Apr 2009
    Posts
    11
    Rep Power
    0

    Default

    guess i'm retarded but i still can't figure it out. thanks anyway guys

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

    Default

    You would do well to post your attempt here along with any error messages, and an indication about which lines are causing the errors (if any) so we can see what you're doing right and what you're doing wrong.

Similar Threads

  1. How To self sign applet
    By Chintan Patel in forum Java Applets
    Replies: 1
    Last Post: 03-16-2009, 03:31 PM
  2. digital sign libraries
    By Shuru in forum Advanced Java
    Replies: 4
    Last Post: 11-07-2008, 09:01 AM
  3. [SOLVED] How to self-sign an Applet?
    By Master Zero in forum Java Applets
    Replies: 3
    Last Post: 09-05-2008, 08:34 AM
  4. Root Finder for polynomials
    By gibsonrocker800 in forum Advanced Java
    Replies: 11
    Last Post: 01-04-2008, 12:26 AM
  5. Library Finder 1.2
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-15-2007, 05:43 PM

Posting Permissions

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