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: beginer neeeds helppppp!

  1. #1
    Member
    Join Date
    Oct 2011
    Posts
    35
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default beginer neeeds helppppp!

    // Rectangle.java - This program prints the outline of a rectangle with 4 asterisks
    // across and 6 asterisks down.
    // Input: None.
    // Output: Prints the outline of the rectangle.

    public class Rectangle
    {
    public static void main(String args[])
    {


    final int NUM_ACROSS = 4; // Number of asterisks to print across.
    final int NUM_DOWN = 6; // Number of asterisks to print down.
    int row; // Loop control for row number.
    int column; // Loop control for column number.

    // This is the work done in the detailLoop()
    for(row=1; row<=NUM_ACROSS; row++){

    for(column=1; NUM_DOWN>5; column++){




    }
    }



    // Write a loop to control the number of rows.
    // Write a loop to control the number of columns
    // Decide when to print an asterisk in every column.

    // Decide when to print asterisk in column 1 and column 4.

    // Decide when to print a space instead of an asterisk.
    System.out.print(" ");
    // Figure out where to place this statement that prints a newline.


    // This is the work done in the endOfJob() method
    System.exit(0);



    } // End of main() method.

    } // End of Rectangle class.

    I dont know how to do the rest they say use an if statement to determine when to print an asterisk so that you can have a rectangle at the end but i cant figure it out im not sure if my loops are even right. can someone explain and show how this is done using this code that is on here. the loops i have added but thats all. in the course im taking this is all that i can use.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: beginer neeeds helppppp!

    Please use the code tags to make your code readable by human eyes. You mention you don't know how to do the rest, so forget the code for a moment - if you were to do this by hand, how would you do it? Write the steps down, and there's your algorithm. Next, translate that into code, breaking the algorithm down and working on it one step at a time
    Suggested reading:
    http://www.javaprogrammingforums.com...-get-help.html
    http://www.javaprogrammingforums.com...e-posting.html

Similar Threads

  1. Helppppp!
    By DellHell in forum Object Oriented Programming
    Replies: 4
    Last Post: December 9th, 2010, 04:58 AM
  2. Yet another beginer help post...
    By Gondee in forum JDBC & Databases
    Replies: 3
    Last Post: November 14th, 2010, 02:31 AM