Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class KBowlOpps{
- public static ArrayList<QuestionAnswer> getChallengeQuestions(){
- ArrayList<QuestionAnswer> questAns = new ArrayList<QuestionAnswer>();
- /**
- * for(int i=0;i<questAns.length;i++){
- questAns[i] = new QuestionAnswer();
- }
- */
- int j = 0;
- int k = 0;
- int rI;
- for(int i = 0; i < 20;i++){
- for(; j < (k+3) && j < 60; j++){
- Random r = new Random();
- try{
- rI = r.nextInt(arrays.get(i).size());
- while(rI%2 != 0){
- rI++;
- }
- //questAns[j].setQuestion(arrays[i][rI]);
- //questAns[j].setAnswer(arrays[i][(rI + 1)]);
- questAns.add(new QuestionAnswer(arrays.get(i).get(rI), arrays.get(i).get(rI + 1)));
- }catch(IndexOutOfBoundsException e){
- }
- }
- k = j;
- }
- questAns = shuffle(questAns);
- for(int l = 0; l <questAns.size() && questAns.get(l).getQuestion() != null; l++){
- System.out.println((l + 1)+") "+questAns.get(l).getQuestion());
- System.out.println(" "+(l + 1)+") "+questAns.get(l).getAnswer());
- }
- return questAns;
- }
- public static ArrayList<QuestionAnswer> shuffle(ArrayList<QuestionAnswer> in){
- ArrayList<QuestionAnswer> out = new ArrayList<QuestionAnswer>();
- ArrayList<Integer> used = new ArrayList<Integer>();
- int usedInt;
- Random r = new Random();
- for(int i = 0; i < in.size(); i++){
- usedInt = r.nextInt(in.size());
- while(used.contains(usedInt)){
- usedInt = r.nextInt(in.size());
- }
- out.add(in.get(usedInt));
- used.add(usedInt);
- }
- return out;
- }
- }
- public class KBowlCats{
- public final static File MATH = new File("src/assets/files/math.txt");
- public final static File GLOBAL_TECH = new File("src/assets/files/gt.txt");
- public final static File ARTS = new File("src/assets/files/arts.txt");
- public final static File CAPITALS = new File("src/assets/files/cap.txt");
- public final static File ENGLISH = new File("src/assets/files/eng.txt");
- public final static File DEFAULT = new File("src/assets/files/default.txt");
- public final static File GEOGRAPHY = new File("src/assets/files/geo.txt");
- public final static File GOVERNMENT = new File("src/assets/files/gov.txt");
- public final static File HEALTH = new File("src/assets/files/hea.txt");
- public final static File HISTORY = new File("src/assets/files/his.txt");
- public final static File ITF = new File("src/assets/files/itf.txt");
- public final static File LITERATURE = new File("src/assets/files/lit.txt");
- public final static File OHIO_HISTORY = new File("src/assets/files/ohi.txt");
- public final static File OUR_US = new File("src/assets/files/ous.txt");
- public final static File POTPURRI = new File("src/assets/files/pot.txt");
- public final static File SAFETY = new File("src/assets/files/saf.txt");
- public final static File SCIENCE = new File("src/assets/files/sci.txt");
- public final static File SPELLING = new File("src/assets/files/spe.txt");
- public final static File SPORTS = new File("src/assets/files/spo.txt");
- public final static File VIP = new File("src/assets/files/vip.txt");
- public final static File WORK_LEADERSHIP = new File("src/assets/files/wor.txt");
- public static ArrayList<String> arts = new ArrayList<String>();
- public static ArrayList<String> capitals = new ArrayList<String>();
- public static ArrayList<String> english = new ArrayList<String>();
- public static ArrayList<String> geography = new ArrayList<String>();
- public static ArrayList<String> globalTech = new ArrayList<String>();
- public static ArrayList<String> government = new ArrayList<String>();
- public static ArrayList<String> health = new ArrayList<String>();
- public static ArrayList<String> history = new ArrayList<String>();
- public static ArrayList<String> itf = new ArrayList<String>();
- public static ArrayList<String> literature = new ArrayList<String>();
- public static ArrayList<String> math = new ArrayList<String>();
- public static ArrayList<String> ohioHistory = new ArrayList<String>();
- public static ArrayList<String> ourUS = new ArrayList<String>();
- public static ArrayList<String> potpurri = new ArrayList<String>();
- public static ArrayList<String> safety = new ArrayList<String>();
- public static ArrayList<String> science = new ArrayList<String>();
- public static ArrayList<String> spelling = new ArrayList<String>();
- public static ArrayList<String> sports = new ArrayList<String>();
- public static ArrayList<String> vip = new ArrayList<String>();
- public static ArrayList<String> workLeadership = new ArrayList<String>();
- public static ArrayList<ArrayList<String>> fillArrays(){
- ArrayList<ArrayList<String>> out = new ArrayList<ArrayList<String>>();
- Scanner in;
- try {
- in = new Scanner(MATH);
- while(in.hasNext()){
- math.add(in.nextLine());
- }
- out.add(math);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ MATH+" not found.");
- }
- try {
- in = new Scanner(GLOBAL_TECH);
- while(in.hasNext()){
- globalTech.add(in.nextLine());
- }
- out.add(globalTech);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ GLOBAL_TECH+" not found.");
- }
- try {
- in = new Scanner(ARTS);
- while(in.hasNext()){
- arts.add(in.nextLine());
- }
- out.add(arts);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ ARTS+" not found.");
- }
- try {
- in = new Scanner(CAPITALS);
- while(in.hasNext()){
- capitals.add(in.nextLine());
- }
- out.add(capitals);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ CAPITALS+" not found.");
- }
- try {
- in = new Scanner(ENGLISH);
- while(in.hasNext()){
- english.add(in.nextLine());
- }
- out.add(english);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ ENGLISH+" not found.");
- }
- try {
- in = new Scanner(GEOGRAPHY);
- while(in.hasNext()){
- geography.add(in.nextLine());
- }
- out.add(geography);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ GEOGRAPHY+" not found.");
- }
- try {
- in = new Scanner(GOVERNMENT);
- while(in.hasNext()){
- government.add(in.nextLine());
- }
- out.add(government);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ GOVERNMENT+" not found.");
- }
- try {
- in = new Scanner(HEALTH);
- while(in.hasNext()){
- health.add(in.nextLine());
- }
- out.add(health);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ HEALTH+" not found.");
- }
- try {
- in = new Scanner(HISTORY);
- while(in.hasNext()){
- history.add(in.nextLine());
- }
- out.add(history);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ HISTORY +" not found.");
- }
- try {
- in = new Scanner(ITF);
- while(in.hasNext()){
- itf.add(in.nextLine());
- }
- out.add(itf);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ ITF+" not found.");
- }
- try {
- in = new Scanner(LITERATURE);
- while(in.hasNext()){
- literature.add(in.nextLine());
- }
- out.add(literature);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ LITERATURE+" not found.");
- }
- try {
- in = new Scanner(OHIO_HISTORY);
- while(in.hasNext()){
- ohioHistory.add(in.nextLine());
- }
- out.add(ohioHistory);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ OHIO_HISTORY+" not found.");
- }
- try {
- in = new Scanner(OUR_US);
- while(in.hasNext()){
- ourUS.add(in.nextLine());
- }
- out.add(ourUS);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ OUR_US+" not found.");
- }
- try {
- in = new Scanner(POTPURRI);
- while(in.hasNext()){
- potpurri.add(in.nextLine());
- }
- out.add(potpurri);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ POTPURRI+" not found.");
- }
- try {
- in = new Scanner(SAFETY);
- while(in.hasNext()){
- safety.add(in.nextLine());
- }
- out.add(safety);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ SAFETY+" not found.");
- }
- try {
- in = new Scanner(SCIENCE);
- while(in.hasNext()){
- science.add(in.nextLine());
- }
- out.add(science);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ SCIENCE+" not found.");
- }
- try {
- in = new Scanner(SPELLING);
- while(in.hasNext()){
- spelling.add(in.nextLine());
- }
- out.add(spelling);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ SPELLING+" not found.");
- }
- try {
- in = new Scanner(SPORTS);
- while(in.hasNext()){
- sports.add(in.nextLine());
- }
- out.add(sports);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ SPORTS+" not found.");
- }
- try {
- in = new Scanner(VIP);
- while(in.hasNext()){
- vip.add(in.nextLine());
- }
- out.add(vip);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ VIP+" not found.");
- }
- try {
- in = new Scanner(WORK_LEADERSHIP);
- while(in.hasNext()){
- workLeadership.add(in.nextLine());
- }
- out.add(workLeadership);
- } catch (FileNotFoundException e) {
- System.err.println("File: "+ WORK_LEADERSHIP+" not found.");
- }
- return out;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement