Esempio n. 1
0
 public static void main(String[] args) throws FileNotFoundException {
   Scanner console = new Scanner(System.in);
   System.out.print("File or entered manually? (type f for file) ");
   if (console.nextLine().toLowerCase().equals("f")) {
     System.out.print("Your own file or the file programmed in? (type o for your own) ");
     if (console.nextLine().toLowerCase().equals("o")) {
       System.out.print("What is the name of your file? ");
       File f = new File(console.nextLine());
       while (!f.exists() || f.isDirectory()) {
         System.out.println("Please try again");
         System.out.print("What is the name of your file? ");
         f = new File(console.nextLine());
       }
       process(new Scanner(f));
     } else {
       Scanner input = new Scanner(new File("euclideanAlgorithmProblems.txt"));
       process(input);
     }
   } else {
     System.out.println(userIntro());
     // cant say continue
     boolean onward = true;
     while (onward) {
       try {
         Equation e = generateEquationFromUser(console);
         System.out.println("\n" + getFullAnswer(e));
       } catch (NullPointerException n) {
         onward = false;
       }
     }
   }
 }