aspose file tools*
The moose likes Beginning Java and the fly likes This is Homework Just need a hint:????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "This is Homework Just need a hint:?????" Watch "This is Homework Just need a hint:?????" New topic

This is Homework Just need a hint:?????

Ryan Perlman

Joined: Oct 31, 2001
Posts: 23
I am using for loops to get a pattern printed I have one for loop for my rows and then seven for loops to print 4 triangles and three blank spaces. I can print all my triangles and my space but I am having trouble getting my 3 tri mirror my 2nd and my 4 tri mirror my frirst. I am printing out of "*". Yes this is an assignment. I don't want the code maybe just a good hint;
Thank you Ryan Perlman

Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
You could always replace your 7 loops with a method to print a char x number of times.
Junilu Lacar

Joined: Feb 26, 2001
Posts: 4456

Start by doing everything by hand, then look for a pattern. When you find a pattern, figure out a way of automating the progression in a loop.
Your pattern goes something like this:
* (x1) _ (x5) * (x5) _ (x1) * (x5) _ (x5) * (x1)
* (x2) _ (x4) * (x4) _ (x2) * (x4) _ (x4) * (x2)
* (x3) _ (x3) * (x3) _ (x3) * (x3) _ (x3) * (x3)
* (x4) _ (x2) * (x2) _ (x4) * (x2) _ (x2) * (x4)
* (x5) _ (x1) * (x1) _ (x5) * (x1) _ (x1) * (x5)
Now that you can see the progression a little better, figure out what kind of calculations you need in your loop.

Junilu - [How to Ask Questions] [How to Answer Questions]
Ryan Perlman

Joined: Oct 31, 2001
Posts: 23
Thanks to all the reason I didn't write a method is because technically I don't know how yet it is the next chapter in the book. I was spose to write this using the for loop and
System.out.print(' ');
Here was my actual question
modify exercise 5.10 into a single application that prints all four patterns side by side making clever use of nested for loops
write an app that displays the following patterns separately one below the other. use for loops to generate the patterns. They should be printed by a single statement of the form System.out.print('*'); and System.out.print(' '); the last two patterns require that each line begin with an appropriate number of blank spaces. (That is what was killing me); I did get it and I won't post it. since I have noticed This same and similar question here before.

Perservere and you shall succeed!!!
Ryan Perlman
Bend, Oregon
I agree. Here's the link:
subject: This is Homework Just need a hint:?????