All pastes #477551 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-08 18:26 UTC
rendered paste body
// The "Menu" class.
import java.awt.*;
import hsa.Console;

public class Menu
{
    static Console c;           // The output console

    public static void main (String[] args)
    {
        c = new Console ();
        int type, lines;

        for (int i = 1 ; i <= 1 ; i++)
        {
            c.println ("How many lines would you like to see?");
            lines = c.readInt ();
            if (lines <= 15)
            {
                c.println ("Which triangle would you like to see? 1: Right-angled adjacent, 2: Pyramid shaped");
                type = c.readInt ();
                if (type == 1)
                {
                    c.clear ();
                    c.println ("Type 1 chosen.");
                    int num1 = 1;
                    for (int out = 1 ; out <= lines ; out = out + 1)
                    {
                        for (int inn = 1 ; inn <= out ; inn++)
                        {
                            c.print ('%');
                            num1 = num1 + 2;
                        }

                        c.println ();
                    }
                }
                else if (type == 2)
                {
                    c.clear ();
                    c.println ("Type 2 chosen.");
                    int num = 1;
                    int spacer = lines;
                    for (int out = 1 ; out <= lines ; out = out + 1)
                    {

                        c.print (" ", spacer);
                        for (int inn = 1 ; inn <= out ; inn++)
                        {
                            c.print ('%');

                            num = num + 2;
                        }
                        spacer = spacer - 1;

                        c.println ();
                    }

                }
                else
                {
                    c.clear ();
                    c.println ("Not a valid choice.");
                }

            }
            else
            {
                c.println ("Too many lines.");
            }

        }

        // Place your program here.  'c' is the output console
    } // main method
} // Menu class