Results 1 to 3 of 3

Thread: Homework Help

  1. #1
    Kyoto is offline Member
    Join Date
    Jul 2010
    Rep Power

    Question Homework Help

    /***** DO NOT TOUCH ANYTHING HERE ***********/

    public class Homework4{

    public static void main (String args []) throws IOException{

    //how many stars you want
    int stars = 0;
    System.out.println("Please enter the max number of * you want to see on your triangle");

    // Hook up br to standard input.
    BufferedReader br = new BufferedReader(new InputStreamReader(;
    stars = Integer.parseInt(br.readLine());

    for (int i = 0; i < stars; i ++){
    /*******ENTER MAIN PROGRAM STARTS HERE *****************/

    this is the program and we are suppose to add one more * each time the loop executes. The instructor said to not use char and that it requires a loop.:confused:
    I just need some tips on where to place the loop.

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Destiny Islands
    Rep Power


    You're going to have to provide more information than what you have. We don't know what your assignment is. The best I can guess is that he wants a triangle to be printed out with a bunch of stars... but that's still not really very helpful.

    Also, when you post a question, use [code] tags and post some things you've tried already--this isn't a freebie forum, it's a help forum.

    If you're looking for where to put the loop, it looks like it's already in there. The line above "/*******ENTER MAIN PROGRAM STARTS HERE *****************/" is a for statement, which starts a loop for those 3 conditions. The for Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)

  3. #3
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Waterford, Ireland
    Rep Power


    The program as it is will in no way print a triangle of stars, your for loop needs addtional code to make that happen, what kind of triangle should it be?

Similar Threads

  1. Homework help please
    By chick in forum New To Java
    Replies: 22
    Last Post: 03-19-2010, 07:39 AM
  2. Homework help
    By rclausing in forum New To Java
    Replies: 26
    Last Post: 11-24-2009, 06:06 AM
  3. Please Help with Homework
    By theuser in forum Advanced Java
    Replies: 2
    Last Post: 07-30-2009, 03:37 PM
  4. Homework help...
    By robrobrob in forum New To Java
    Replies: 4
    Last Post: 10-17-2008, 04:24 AM
  5. Need help with homework.
    By JavaNewbie0000 in forum New To Java
    Replies: 2
    Last Post: 07-31-2008, 03:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts