Parsing strings

This is a discussion on Parsing strings within the C Programming forums, part of the General Programming Boards category; oh ok thank you can anyone help out with this one pls?! is it a hard program to write or ...

  1. #1
    Registered User Ashl7's Avatar
    Join Date
    Oct 2012
    Posts
    57

    Parsing strings

    oh ok thank you
    can anyone help out with this one pls?!
    is it a hard program to write or an easy one?!

    Write a Complete program for the following specification:
    The SerialNumber class takes a serial number in
    the form of LLLLLLLLLLLL-DDDDDDDDD-LLLLLLLLL where each L is a letter
    and each D is a digit. The serial number has three groups
    of characters, separated by hyphens.
    Note: This time any number of letters followed by - followed by any number of digit followed by – followed by any number of letters.
    Example:
    String serial1= "GHFFFFFTRJ-8978888885-AQTTTTWR"; // Valid
    String serial2 = "GHT7J-8975-AQWR"; // Invalid
    String serial3 = "GHTRJ-8J75-AQWR"; // Invalid
    String serial4 = "GHTRJ-8975-AQ2R"; // Invalid


    it seems like to ask for a random serial number, and then wants us to enter a serial number, and then see if that's right or wrong....
    anyone could give me a hint to start it out?! I'm not sure how to generate a random serial number...(is it possible to have a random character generator?)...and then how do I use "-" in between the entries?!
    would appreciate it so much
    Last edited by Ashl7; 10-13-2012 at 02:27 AM.

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    Quote Originally Posted by Ashl7 View Post
    Write a Complete program for the following specification:
    The SerialNumber class takes a serial number in
    the form of LLLLLLLLLLLL-DDDDDDDDD-LLLLLLLLL where each L is a letter
    and each D is a digit. The serial number has three groups
    of characters, separated by hyphens.
    Note: This time any number of letters followed by - followed by any number of digit followed by followed by any number of letters.
    Example:
    String serial1= "GHFFFFFTRJ-8978888885-AQTTTTWR"; // Valid
    String serial2 = "GHT7J-8975-AQWR"; // Invalid
    String serial3 = "GHTRJ-8J75-AQWR"; // Invalid
    String serial4 = "GHTRJ-8975-AQ2R"; // Invalid
    Are you sure you are supposed to write the program in C? It looks like C++ for me.

    Quote Originally Posted by Ashl7 View Post
    it seems like to ask for a random serial number, and then wants us to enter a serial number, and then see if that's right or wrong....
    anyone could give me a hint to start it out?! I'm not sure how to generate a random serial number...(is it possible to have a random character generator?)...and then how do I use "-" in between the entries?!
    I don't think you should write a random serial number generator. I think you should write a validator function, checking if the provided serial number is valid or not.

    Anyways, how would you generate a random serial number on paper? If you can describe each step you do, you have your basic algorithm :-)

    Bye, Andreas

  3. #3
    qny
    qny is offline
    Registered User
    Join Date
    Sep 2012
    Posts
    355
    Post your attempt. We're not going to do your homework for you, but we may nudge in the right direction

  4. #4
    Registered User Ashl7's Avatar
    Join Date
    Oct 2012
    Posts
    57
    oh shoot I didn't know my post came here LOL
    ok I'll show you guys my power

  5. #5
    Registered User Ashl7's Avatar
    Join Date
    Oct 2012
    Posts
    57
    OK , I guess my mind is going to explode from all the datum I got from you guys in the last 24 hours...seriously I wrote 4 programs in one day and 2 of them were really REALLY hard!! I need to get some sleep, it's 3:45 Am in LA....
    I guess I'm going to dream about waking up in the morning and seeing the above assignment is done by you guys...hmmm sweet dreams...

  6. #6
    Registered User
    Join Date
    Oct 2012
    Posts
    5
    C programming @ Smc 2morrow @ 1 PM ?

  7. #7
    Registered User Ashl7's Avatar
    Join Date
    Oct 2012
    Posts
    57
    omg!! I hope you're not Abbas!!! LOL

  8. #8
    Registered User
    Join Date
    Oct 2012
    Posts
    5
    Haha I'm not, but I will see you there

  9. #9
    Registered User Ashl7's Avatar
    Join Date
    Oct 2012
    Posts
    57
    no no no no this is WRONG!!!
    how did u do so far?!

  10. #10
    Registered User
    Join Date
    Oct 2012
    Posts
    5
    I'm trying to figure out the largest & count its occurrences assignment

  11. #11
    Registered User
    Join Date
    Oct 2012
    Posts
    5
    And the serial validator :P

  12. #12
    Registered User Ashl7's Avatar
    Join Date
    Oct 2012
    Posts
    57
    that's it?! lol
    SEE GUYS...NOW THERE ARE TWO PEOPLE HERE WHO NEED YOUR HELP FOR THIS ASSIGNMENT...
    well, good luck...and good night

  13. #13
    Registered User
    Join Date
    Oct 2012
    Posts
    5
    Do you need help with someone?

  14. #14
    Registered User Ashl7's Avatar
    Join Date
    Oct 2012
    Posts
    57
    well I don't know, it depends who I'm asking help from lol
    I should be fine...I guess I'll get 15% out of 20% at least
    I only have problem with this problem, the serial number...and the education assistant(a little bit)...
    check out my post here, see if u can find out what my problem is
    developing an easy CAI programm in C
    later

  15. #15
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,648
    Quote Originally Posted by Ashl7 View Post
    OK , I guess my mind is going to explode from all the datum I got from you guys in the last 24 hours...seriously I wrote 4 programs in one day and 2 of them were really REALLY hard!! I need to get some sleep, it's 3:45 Am in LA....
    I guess I'm going to dream about waking up in the morning and seeing the above assignment is done by you guys...hmmm sweet dreams...
    Keep dreaming. We don't do your assignments for you. Bad enough you're being spoonfed in your other thread.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Parsing strings
    By Shingetsu Kurai in forum C++ Programming
    Replies: 12
    Last Post: 07-11-2011, 12:05 PM
  2. Parsing of strings
    By nsp in forum C Programming
    Replies: 4
    Last Post: 02-16-2011, 07:51 AM
  3. Parsing strings
    By Tupcia in forum C++ Programming
    Replies: 19
    Last Post: 04-24-2008, 09:38 AM
  4. Parsing Strings
    By Hunter2 in forum C++ Programming
    Replies: 29
    Last Post: 12-05-2004, 06:48 PM
  5. Parsing Strings
    By SubLogic in forum C++ Programming
    Replies: 15
    Last Post: 01-07-2003, 10:11 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21