Results 1 to 3 of 3
  1. #1
    Zora is offline Member
    Join Date
    Sep 2011
    Rep Power

    Default Converting numbers to words

    Hey, it's me, back again with another program assignment. This time I have to convert numbers into words. I think the hardest part for me is separating the string input with commas. I tried using the .split("(?<=\\G.{3})") function, but it came out as [123,456,789,0] instead of 1,234,567,890 which is what I want. Also, identifying the hundredths, thousandths, seems pretty difficult too. The whole problem is hard, especially when I can't use too many if-else statements. :/

    1. Write a java program to read a number up to 15 digits long or a date (dd/mm/yyyy).
    2. The program should distinguish numbers from input date, and prints them in alphabetic spelling form.

    Example: for input 234334564456455 the output should be :
    234,334,564,456,455 is two hundred thirty four trillion and three hundred thirty four billion and five hundred sixty four million and for hundred fifty six thousand and four hundred fifty five.

    For input 23/3/1996 it should print: March 23, 1996.

    3. Split your program into appropriate methods.

    Note 1: Use arrays of strings.
    Note 2: Avoid using excessive if-else statements, otherwise you will end up in a poor mark even your program works fine.
    Note 3: Each method should do one simple task, and it should not be longer that one screen shot.
    Note 4: Choose right algorithm, and make your program short and easy to be managed.
    Note 5: Think about arrays, index of arrays, and loops. (Refer to our exercise in the class about rolling dice)
    Note 6: Assume user inputs number or date in a correct format.

  2. #2
    2Pac is offline Member
    Join Date
    Nov 2011
    Rep Power

    Default Re: Converting numbers to words

    Noone is going to do YOUR homework for you. If you need help with a specific part of this assignment then go ahead and ask, but I highly doubt someone's going to take the time to do your whole assignment. Not to mention you're not going to learn anything that way either.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Converting numbers to words

    I answered exactly this question (including working code!) before; all you have to do is search through my 8000 or so postings ;-)

    kind regards,

    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. Writing a java applet that converts numbers to words
    By derekmski in forum Java Applets
    Replies: 1
    Last Post: 04-16-2011, 04:33 AM
  2. Replies: 11
    Last Post: 01-14-2011, 07:36 PM
  3. converting letters to numbers
    By fenhoff in forum New To Java
    Replies: 2
    Last Post: 01-24-2010, 05:45 AM
  4. new to java, converting words into numbers
    By echo33 in forum New To Java
    Replies: 4
    Last Post: 04-22-2009, 10:52 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