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

Thread: Need help coding this program with for loops

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    2
    My Mood
    Cold
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need help coding this program with for loops

    hey guys. i need to create a program for my comp sci class. i'm having trouble in general on setting up the 4th step of the program. here is what i need to do:
    1. print the prompt "enter square type".
    2. it should then read a string which your program will assume is one of three words, "solid", "alternating", or "hollow".
    3. it should then print the message "enter size" and read an integer which will represent the size of the square to be printed.
    4. if the word hollow is entered, you program should print a square whose border is made of a single pound-sign character but whose interior is just composed of blank space characters. for example, the sqaure for size 4 would look like
    ####
    #~~#
    #~~#
    ####

    the ~ indicates a blank space. i just wanted to clarify. so yeah. i know how to print the entire box filled with the pound-sign. like i know the code to create this output:
    (input size 4)
    ####
    ####
    ####
    ####

    but i dont get how i can create those spaces in the middle. i did the first 3 steps with all the prompts and stuff. just need to properly execute the 4th step please help. thanks in advance!


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Need help coding this program with for loops

    Really?
    Oh my god, no, you are kidding me, right?
    Wow... we were looking for such a person who could help us... Thanks you have just solved our problem... We are so happy that you have just given us some work to do....
    I hope you read the forum rules??????
    If no, for God sake, read them HERE!!!!!!!!!!!!!!!!!!

  3. #3

    Default Re: Need help coding this program with for loops

    Quote Originally Posted by Mr.777 View Post
    Really?
    Oh my god, no, you are kidding me, right?
    Wow... we were looking for such a person who could help us... Thanks you have just solved our problem... We are so happy that you have just given us some work to do....
    I hope you read the forum rules??????
    If no, for God sake, read them HERE!!!!!!!!!!!!!!!!!!
    I think somebody has forgotten about rule# 4... Be respectful and courteous.

    Just sayin'...
    Kenneth Walter
    Software Developer
    http://kennywalter.com

  4. #4
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Need help coding this program with for loops

    Quote Originally Posted by kenster421 View Post
    I think somebody has forgotten about rule# 4... Be respectful and courteous.

    Just sayin'...
    Did i show any disrespect???

Similar Threads

  1. how come this program only loops twice? wheres my mistake?
    By Rainy in forum What's Wrong With My Code?
    Replies: 2
    Last Post: September 3rd, 2011, 09:49 AM
  2. program loops never ending
    By Ccogh05 in forum Loops & Control Statements
    Replies: 5
    Last Post: February 24th, 2011, 01:42 AM
  3. Program without loops and recursion
    By jayaram in forum Algorithms & Recursion
    Replies: 7
    Last Post: April 1st, 2010, 09:02 AM
  4. Program with for loops help
    By ixjaybeexi in forum Loops & Control Statements
    Replies: 23
    Last Post: October 8th, 2009, 10:05 AM
  5. [SOLVED] Fixing of bug in number guessing game
    By big_c in forum Loops & Control Statements
    Replies: 6
    Last Post: April 16th, 2009, 02:15 AM

Tags for this Thread