Howdy , I am trying to write a program which accepts an integer between 1 and 20 and then outputs a progessivly larger hill using 2 different text characters. So for example if I would input a 1 the output would be a
if i input a 2 the output would be a
#
if i input a 3 the output would be a
###
ect....
Right now i am trying to do it with nested for loops but i can't get it working correctly...here is what I have so far
{
public static void main(String [] args)
{
MainWindow mainWindow;
InputBox inputBox;
OutputBox outputBox;
mainWindow = new MainWindow ();
outputBox = new OutputBox (mainWindow);
inputBox = new InputBox (mainWindow);
mainWindow.setVisible( true );
outputBox.setVisible( true );
int hh;
int hhh;
int hill;
int count = 1;
do
{
hill = inputBox.getInteger("Enter an integer between 1 and 20"
;
}
while (hill > 20 || hill < 1);
outputBox.printLine("\\"
;
for (hh = hill - 1; hh > 0; hh--)
{
outputBox.printLine("#"
;
hh --;
for (hhh = hh - 1; hhh > 0; hhh--)
{
outputBox.printLine("\\"
;
}
}
}
}
any info appricated, thanks!
if i input a 2 the output would be a
#
if i input a 3 the output would be a
###
ect....
Right now i am trying to do it with nested for loops but i can't get it working correctly...here is what I have so far
{
public static void main(String [] args)
{
MainWindow mainWindow;
InputBox inputBox;
OutputBox outputBox;
mainWindow = new MainWindow ();
outputBox = new OutputBox (mainWindow);
inputBox = new InputBox (mainWindow);
mainWindow.setVisible( true );
outputBox.setVisible( true );
int hh;
int hhh;
int hill;
int count = 1;
do
{
hill = inputBox.getInteger("Enter an integer between 1 and 20"
}
while (hill > 20 || hill < 1);
outputBox.printLine("\\"
for (hh = hill - 1; hh > 0; hh--)
{
outputBox.printLine("#"
hh --;
for (hhh = hh - 1; hhh > 0; hhh--)
{
outputBox.printLine("\\"
}
}
}
}
any info appricated, thanks!