I made a program that is supposed to ask for a shape and then make a green shape and then ask you if you wanted to make another shape. That didn't work so I changed it to ask if you wanted to make another shape after this one and put the println before the prompt.That didn't work either could anyone tell me whats wrong with the following code.
// The "Shape_Generator" class.
import java.awt.*;
import hsa.Console;
public class Shape_Generator
{
static Console c;
public static void main (String[] args)
{
c = new Console ();
int on_off = 1;
int contin = 1;
char shape;
char answr;
{
while (contin == 1)
{
while (on_off == 1)
{
c.println ("Type in \"r\" for rectangle or \"o\" for oval.");
shape = c.readChar ();
c.println ("Do you want to make another shape after this one? y or n");
answr = c.readChar ();
if (shape == 'r')
{
c.fillRect (100, 100, 100, 100);
c.setColor (Color.green);
on_off = 0;
}
if (shape == 'o')
{
c.fillOval (100, 100, 100, 100);
c.setColor (Color.green);
on_off = 0;
}
if (answr == 'y')
{
on_off = 1;
}
if (answr == 'n')
{
contin = 0;
}
}
}
}
}
}