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

Thread: Box Set

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Box Set

    How do you print such problem?

    Enter a letter
    Ex. f

    ffffff
    ffffff eeeee
    ffffff eeeee dddd
    ffffff eeeee dddd ccc
    ffffff eeeee dddd ccc bb
    ffffff eeeee dddd ccc bb a

    Ex. c

    ccc
    ccc bb
    ccc bb a
    Last edited by cosecant; October 15th, 2009 at 07:58 PM. Reason: typing error


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: Box Set

    Hello cosecant,

    Welcome to the Java Programming Forums.

    Can you please give a bit more detail about the desired output?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  3. #3
    Junior Member
    Join Date
    Oct 2009
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Box Set

    You input a letter. Then you print it its place in the alphabet time(for example b would be bb).
    Then you print it again and then add the letter before it, its corresponding position number of times.
    Continue adding as seen in example until a is reached.

    Ex. d

    dddd //The letter its postions times
    dddd ccc // letter again and letter before its position times
    dddd ccc bb // continuing on
    dddd ccc bb a // finished

  4. #4
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Box Set

    What code do you have so far, where exactly are you stuck?

    // Json

  5. #5
    Junior Member
    Join Date
    Oct 2009
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Box Set

    I have use multiple for loops, but i have had trouble getting it to print the middle line for example
    I have been able to print(for ex.f) ffffff and ffffff eeeee dddd ccc bb a, but i cannot figure out the for loop required to keep adding characters while keeping the previous ones.

  6. #6
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Box Set

    Save a string of what you're printing out.

    String output = "";
    for (number of lines to print out)
         output += number of characters to add
         System.out.println(output);