import java.io.*;//imports the keyboard function
public class GcF
{
char a,x,y,z;
public static void main(String[] args)
{
FileOutputStream out;
PrintStream p;
try
{
out = new FileOutputStream("horay.txt");
p = new PrintStream(out);
}
catch (NullPointerException e)
{
System.out.println("Stop trying to kill my programs!\n");
}
try
{
System.out.println("Program #2 \nThe GCF Game \nBy: Thomas Boeckman\n\n");//header
Playgame();
}
catch (NullPointerException e)// stops most errors from showing
{
System.out.println("Hanosh! stop trying to sabatoge my programs!");
Playgame();
}
}
public static void Playgame() throws IOException
{
try
{
String YesorNo;
BufferedReader keyboard;
boolean loopNeeded;// creates a loop
keyboard = new BufferedReader(new InputStreamReader(System.in));//takes input from the keyboard
System.out.println ("Would you like to play the GCF game?\n Please type Yes or No and press Enter");
YesorNo = keyboard.readLine();// assigns the entered string tothe variable YesorNo
if (YesorNo.equalsIgnoreCase("yes"))
gcfNumbers();//sends the program to gcfNumbers
else if (YesorNo.equalsIgnoreCase("no"))
{
System.out.println("Thanks for playing the GCF game!");
System.exit(1);// ends the program
}
else
{
System.out.println("Oh wizened old fart, please type Yes or No and press Enter");
Playgame();// repeats
}
}
catch (NullPointerException e)
{
System.out.println("Oh Inferior One, why must you try to spoil my programs?");
Playgame();
}
}
public static void gcfNumbers()
{
try
{
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();
if (a == 2)
{
twoNumGCF();
}
else if (a == 3)
{
threeNumGCF();
}
else
{
System.out.println("What are you doing?\n What is so hard about typing a 2 or a 3, I mean, come on!");
gcfNumbers();
}
}
catch (NullPointerException e)
{
System.out.println("Why must you bother me so, Hanosh?\n");
}
};
}
-code box edited in by supersloth
This post has been edited by supersloth: 14 October 2005 - 01:06 PM

New Topic/Question
Reply



MultiQuote




|