Hi, I just finished up AP Computer Science a few weeks ago and decided to write an app that allows me to quiz myself with vocab words and definitions, it works fine while I'm running it in IDE, but when I make it a JAR it refuses to open (I'm on OSX), I tried making it an application, but have had no luck. I would like the app to open via terminal so that it can be run in command line for now, in the future I will learn how to make a GUI for the program..could anyone point me in the right direction for learning GUI in java (I use NetBeans) along with helping me get my app running so I can distribute it among my eager friends?
It's not close to finished...but here's the work in progress..
package QuizMe;
import java.util.Scanner;
public class QuizMe {
public static void main(String[] args) {
boolean run = true;
System.out.print("Please enter the number of words you would like to learn: ");
Scanner input = new Scanner (System.in);
int amount = input.nextInt();
int count = 0;
String[] terms = new String[amount];
String[] answers = new String[amount];
for (int i = 0; i < terms.length; i++) {
System.out.printf("Please enter term #%d: ", i + 1);
terms[i] = input.next();
System.out.printf("Please enter answer #%d: ", i + 1);
answers[i] = input.next();
}
while (run) {
System.out.println("");
System.out.println("Would you like to...");
System.out.println("[1]. Edit your terms/answers");
System.out.println("[2]. Add more terms/answers");
System.out.println("[3]. Remove terms/answers");
System.out.println("[4]. Be Quizzed");
System.out.println("[5]. Exit the program\n");
System.out.print("Please enter a number choice: ");
int menuinput = input.nextInt();
// if (menuinput == 3) {
// System.out.println("Would you first like to view the terms and answers? [Y]es/[N]o? ");
// String yesno = input.next();
// if (yesno.equals("Y")) {
// System.out.println("Terms:");
// for (int i = 0; i < terms.length; i++) {
// System.out.printf("Term #%d: " + terms[i] + "\t\n", count + 1);
// }
// System.out.println("\nAnswers:");
// for (int i = 0; i < answers.length; i++) {
// System.out.printf("Answer #%d: " + answers[i] + "\t\n", count + 1);
// }
// }
//
// System.out.println("Please enter which term/answer you would like to be deleted: ");
// int delete = input.nextInt();
// if (delete > terms.length || delete < terms.length) {
// System.out.println("Please enter a valid term/answer number...");
// } else {
// terms[delete - 1] = null;
// answers[delete - 1] = null;
//
// }
// }
if (menuinput == 4) {
while (count < terms.length) {
System.out.printf("Term #%d: " + terms[count] + "\n", count + 1);
System.out.println("Press enter to see the answer for this term...");
input.nextLine();
System.out.printf("Answer #%d: " + answers[count] + "\n", count + 1);
System.out.println("");
count++;
}
System.out.println("You have finished being quized!");
}
if (menuinput == 5) {
System.out.print("Are you sure you want to quit, you will lose any entered information? [Y]es/[N]o? ");
String yesno = input.next();
if (yesno.equals("Y")) {
System.out.println("Goodbye!");
run = false;
} else {
continue;
}
}
}
}
}