Results 1 to 3 of 3
Thread: Homework Help
- 07-29-2010, 05:31 PM #1
Member
- Join Date
- Jul 2010
- Posts
- 1
- Rep Power
- 0
Homework Help
/***** DO NOT TOUCH ANYTHING HERE ***********/
import java.io.*;
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(System.in));
stars = Integer.parseInt(br.readLine());
for (int i = 0; i < stars; i ++){
/*******ENTER MAIN PROGRAM STARTS HERE *****************/
System.out.println("*");
System.out.println("\n");
}
}
}
}
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.
- 07-29-2010, 07:50 PM #2
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)
- 07-30-2010, 12:30 AM #3
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
Similar Threads
-
Homework help please
By chick in forum New To JavaReplies: 22Last Post: 03-19-2010, 07:39 AM -
Homework help
By rclausing in forum New To JavaReplies: 26Last Post: 11-24-2009, 06:06 AM -
Please Help with Homework
By theuser in forum Advanced JavaReplies: 2Last Post: 07-30-2009, 03:37 PM -
Homework help...
By robrobrob in forum New To JavaReplies: 4Last Post: 10-17-2008, 04:24 AM -
Need help with homework.
By JavaNewbie0000 in forum New To JavaReplies: 2Last Post: 07-31-2008, 03:06 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks