Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Match Mobile carrier

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Match Mobile carrier

    Please help me i need to know the simple way to answer this program without using recursion.


    3. Save the ff. data into a different array.

    Smart: 0907, 0908, 0909, 0910, 0912, 0918, 0919, 0920, 0921, 0928, 0929, 0930, 0938, 0939, 0946, 0947, 0948, 0949, 0989, 0999, 0998, 0937
    Globe: 0905, 0906, 0915, 0916, 0917, 0926, 0927, 0935, 0936, 0996, 0997, 0975, 0977
    Sun: 0922, 0923, 0925, 0932, 0933, 0934, 0942, 0943


    The user will be asked to enter a mobile number (e.g. 09181234567) and the program will identify which Telecom (i.e. Smart Globe, Sun) owns the number. The mobile number will also be validated. If its character length is not 11, the program will display “The mobile number must be 11 digits long” If the mobile number contains a letter or symbol (e.g. 0918a234567), the program will display “The mobile number is not valid”. If the mobile number is not belonging to any of the telecoms, the program will display “The entry is not a Smart/Globe/Sun number”. You may only telecom prefixes (e.g. 0907, 0908, 0917) must be read from the array.

    Sample Run:
    Enter a mobile number:
    Input Output
    09182456187 The mobile number is a Smart number.
    09175879654 The mobile number is a Globe number.
    09224874787 The mobile number is a Sun number.
    09008785465 The entry is not a Smart/Globe/Sun number.
    091045742a7 The mobile number is not valid.
    09124587 The mobile number must be 11 digits long.


  2. #2
    Member
    Join Date
    Aug 2013
    Posts
    95
    Thanks
    3
    Thanked 14 Times in 14 Posts

    Default Re: Match Mobile carrier

    You should look into Strings and comparing portions. You don't need recursion for this, you can simply do this using if else statements.

Similar Threads

  1. quick match
    By vineet kumar in forum What's Wrong With My Code?
    Replies: 5
    Last Post: July 5th, 2013, 02:06 AM
  2. Replies: 0
    Last Post: July 26th, 2011, 10:31 PM
  3. Replies: 0
    Last Post: June 18th, 2010, 07:18 AM