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 3 of 3

Thread: Java application Hint

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Java application Hint

    Hello guys,


    I need a hint for creating that application:

    "Use the methods developed in parts (a) and (b) to write a method displayDigits that
    receives an integer between 1 and 99999 and displays it as a sequence of digits, separating
    each pair of digits by two spaces. For example, the integer 4562 should appear as
    4 5 6 2
    Incorporate the methods into an application that inputs an integer and calls display-
    Digits by passing the method the integer entered. Display the results."

    note: the methods developed in parts a and b was to divide a by b and calculate the quotient and the remainder

    I've think of it as converting that integer number into a String one and using charAt with FOR loop. but it seems that the question is forcing me to use both division and remainder to solve it


    Thanks in advance


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,066
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java application Hint

    use both division and remainder to solve it
    Write a small test program to use / & % with a number to see what they do.
    What does 123 % 10 give?
    What does 123 / 10 give?

    Using those two operators you can extract the base 10 digits one at a time.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following 2 Users Say Thank You to Norm For This Useful Post:

    Ahmedz (August 26th, 2012), curmudgeon (August 27th, 2012)

  4. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java application Hint

    Quote Originally Posted by Norm View Post
    Write a small test program to use / & % with a number to see what they do.
    What does 123 % 10 give?
    What does 123 / 10 give?

    Using those two operators you can extract the base 10 digits one at a time.


    got it .

    Thanks alot!

Similar Threads

  1. Replies: 5
    Last Post: September 26th, 2011, 12:54 PM
  2. how to run any installed application through my java application??
    By sgsamanthjain in forum Java Theory & Questions
    Replies: 1
    Last Post: April 1st, 2011, 08:17 AM
  3. Replies: 1
    Last Post: January 12th, 2011, 04:55 AM
  4. Homework help, don't understand teach's hint, need some direction
    By crazed8s in forum Java Theory & Questions
    Replies: 2
    Last Post: December 8th, 2010, 03:56 PM
  5. Replies: 0
    Last Post: December 3rd, 2009, 03:43 PM