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 Programming Problem Help pls!

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Programming Problem Help pls!

    Hey if anyone out their can help me out ASAP, It will very much be appreciated.


    (format an integer) Write a method with the following header to format the integer with the specified width.
    public static String format(int number, int width)



    The method returns a string of the number with on or more prefix 0s. the size of the string is the width. For example, format (34,4) returns 0034 and format (35,5) returns 00034. If the number is longer than the width, the method returns the string representation of the number. For example, format (34,1) returns 34.

    Write a test program that prompts the user to enter a number and its width and displays a string returned by invoking format (number, width).



    Thanks!


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Java Programming Problem Help pls!

    We will not do it for you. Write your own code, if you get stuck post the code here (using code tags), include error messages and ask a specific question. Start with a piece of paper and work out an algorithm. How do YOU know how many 0's need to go in front of 34 if the String needs to have a length of 4?
    Improving the world one idiot at a time!

  3. #3
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Java Programming Problem Help pls!

    Thread closed as a homework dump.
    Closed to prevent someone from dumping the code, not to discourage future questions.
    If you have a question you would like to ask, start a new thread and ask it.

Similar Threads

  1. how do i solve this programming problem in dr java?
    By jennavg in forum What's Wrong With My Code?
    Replies: 4
    Last Post: April 8th, 2013, 12:22 PM
  2. can you pls help me in this java programming? code=java
    By srivani in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 25th, 2012, 02:31 AM
  3. java programming loop problem
    By darking123 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 11th, 2012, 05:48 PM
  4. Java applet programming problem
    By danielparry in forum What's Wrong With My Code?
    Replies: 8
    Last Post: March 4th, 2011, 11:31 AM
  5. Java Web Browser Term Project- I am facing multiple problem...pls help
    By tazbinur in forum What's Wrong With My Code?
    Replies: 11
    Last Post: October 8th, 2010, 09:05 AM