I need help with nested while loops

Programming
Tutor: None Selected Time limit: 1 Day

I need help printing triangles with "*" and " " with nested while loops, but no for loops. I understand that I can change the for loops into while loops, but I am having difficulty creating  boolean method required by the specs of the project.

Oct 14th, 2015

Thank you for the opportunity to help you with your question!

you can find the below mentioned method 


/**
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package loop;

/**
 *
 * @author ACHCHUTHAN
 */
public class Pyramids {

    public static void main(String[] args) {
        for (int i = 1; i <= 5; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print("#");
            }
            System.out.println("");
        }

}

Please let me know if you need any clarification. I'm always happy to answer your questions.
Oct 14th, 2015

Thank you. I understand this part but I have to create a private static method to draw each 1 of the 4 triangles, and a boolean method to check the acceptable size range of the triangle, from the scanner input. When I call these methods within my main method, they print an error. Would you happen to know why that is the case? And I cannot use for loops, so I changed this to nested while loops.

Oct 14th, 2015

ok. now you can try it. then let me know.

/**
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package loop;

/**
 *
 * @author ACHCHUTHAN
 */
public class Pyramids {

    public static void main(String[] args) {
        
        for (int i = 5; i >= 0; i--) {
            for (int s = 1; s < i; s++) {
                System.out.print(" ");
            }
            for (int j = 5; j >= i; j--) {
                System.out.print("#");
            }
            System.out.println("");
        }
    }
}

Oct 14th, 2015

I need to draw 4 right angle triangles, and so for each triangle I want to draw, I need to have a draw method. This method has the parameter of the " ", "#", the number of times " " is printed and the total number of " " and "#" together in each row. This has to be a static method, and I have to do what you did above, but I do not understand how to do what you did with while loops. 

Oct 14th, 2015

Did you know? You can earn $20 for every friend you invite to Studypool!
Click here to
Refer a Friend
...
Oct 14th, 2015
...
Oct 14th, 2015
Dec 7th, 2016
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer