Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.33 KB | None | 0 0
  1. package valentines;
  2. import java.io.*;
  3. import java.io.BufferedWriter;
  4. import java.awt.Component;
  5. import java.io.FileOutputStream;
  6. import java.io.FileWriter;
  7. import java.io.OutputStreamWriter;
  8. import java.io.PrintWriter;
  9. import java.io.IOException;
  10. import java.io.File;
  11. import java.io.FileNotFoundException;
  12. import javax.swing.ImageIcon;
  13. import javax.swing.JDialog;
  14. import javax.swing.JFrame;
  15. import javax.swing.JOptionPane;
  16. import javax.swing.JRadioButton;
  17. import javax.swing.WindowConstants;
  18. import java.util.Scanner;
  19. /*
  20. @author Kendall Clancy
  21. */
  22.  
  23. public class Valentines
  24. {
  25.  
  26. public static void main(String[] args) throws FileNotFoundException
  27. {
  28. System.out.println("Hello! This is a Valentines Day program that takes your personal preference of a match and imports data and finds a match for everyone!");
  29. System.out.println("This program matches based on your encrypted student ID to other students");
  30. System.out.println("Note: I took out commas using Excel because I spent so many hours trying to use split for the first time and I eventually got stuck");
  31. System.out.println("My code only works on my slightly edited .txt files because of array sizes and such");
  32. System.out.println("");
  33. System.out.println("Correctly Sorts students into Arrays based on Grade:");
  34. Valentines bob = new Valentines();
  35. bob.One();
  36.  
  37. }
  38.  
  39. public void One () throws FileNotFoundException
  40. {
  41. String Name = ""; //1
  42. String Birthday = ""; //2
  43. String Grade = ""; //3
  44. String Gender = ""; //4
  45. String WhyHere = ""; //5
  46. String Look4InRel = ""; //6
  47. String ValTraits = ""; //7
  48. String LoveLanguage = ""; //8
  49. String Spontaneous = ""; //9
  50. String HowOpen = ""; //10
  51. String Politicz = ""; //11
  52. String IdealDate = ""; //12
  53. String DueDate = ""; //13
  54. String PetLove = ""; //14
  55. String SaturdayNight = ""; //15
  56. String Hobbies = ""; //16
  57. String Vacation = ""; //17
  58. String Spend = ""; //18
  59. String Music = ""; //19
  60. String HelloMatch = ""; //20
  61.  
  62.  
  63. String[] Valentines = {Name,Birthday,Grade,Gender,WhyHere,Look4InRel,ValTraits,LoveLanguage,Spontaneous,HowOpen,Politicz,IdealDate,DueDate,PetLove,SaturdayNight,Hobbies,Vacation,Spend,Music,HelloMatch};
  64.  
  65. //String[] bob = {Name};
  66.  
  67.  
  68. Valentines AnnieBot = new Valentines();
  69. // AnnieBot.Startup();
  70.  
  71. AnnieBot.Name(Valentines); //1
  72. AnnieBot.Birthday(Valentines); //2
  73. AnnieBot.Grade(Valentines); //3
  74. AnnieBot.Gender(Valentines); //4
  75. AnnieBot.WhyHere(Valentines); //5
  76. AnnieBot.Look4InRel(Valentines); //6
  77. AnnieBot.ValTraits(Valentines); //7
  78. AnnieBot.LoveLanguage(Valentines); //8
  79. AnnieBot.Spontaneous(Valentines); //9
  80. AnnieBot.HowOpen(Valentines); //10
  81. AnnieBot.Politicz(Valentines); //11
  82. AnnieBot.IdealDate(Valentines); //12
  83. AnnieBot.DueDate(Valentines); //13
  84. AnnieBot.PetLove(Valentines); //14
  85. AnnieBot.SaturdayNight(Valentines); //15
  86. AnnieBot.Hobbies(Valentines); //16
  87. AnnieBot.Vacation(Valentines); //17
  88. AnnieBot.Spend(Valentines); //18
  89. AnnieBot.Music(Valentines); //19
  90. AnnieBot.HelloMatch(Valentines); //20
  91.  
  92. AnnieBot.ReadInFile();
  93.  
  94.  
  95.  
  96. for (int x = 0; x < 19; x++)
  97. {
  98. // System.out.println(Valentines[x]);
  99. }
  100.  
  101.  
  102. // System.out.println(Valentines[19]);
  103.  
  104. System.exit(0);
  105.  
  106.  
  107. }
  108.  
  109.  
  110. public String[] Name (String[] ChangeName)
  111. {
  112.  
  113. String EditNamePane;
  114. EditNamePane = JOptionPane.showInputDialog //Question 1
  115. (
  116. "Enter your name."
  117. );
  118. ChangeName[0] = EditNamePane;
  119.  
  120. return ChangeName;
  121. }
  122.  
  123. public String[] Birthday(String[] ChangeBirthday)
  124. {
  125. JFrame frame = new JFrame("What day is your birthday on?"); //Question 2
  126.  
  127. //Drop down menu (combo box)
  128. Object[] dates =
  129. {"The 1st",
  130. "The 2nd",
  131. "The 3rd",
  132. "The 4th",
  133. "The 5th",
  134. "The 6th",
  135. "The 7th",
  136. "The 8th",
  137. "The 9th",
  138. "The 10th",
  139. "The 11th",
  140. "The 12th",
  141. "The 13th",
  142. "The 14th",
  143. "The 15th",
  144. "The 16th",
  145. "The 17th",
  146. "The 18th",
  147. "The 19th",
  148. "The 20th",
  149. "The 21st",
  150. "The 22nd",
  151. "The 23rd",
  152. "The 24th",
  153. "The 25th",
  154. "The 26th",
  155. "The 27th",
  156. "The 28th",
  157. "The 29th",
  158. "The 30th",
  159. "The 31st"};
  160. String Day = (String) JOptionPane.showInputDialog(frame,
  161. "What day is your birthday on?",
  162. "Quesiton 2",
  163. JOptionPane.QUESTION_MESSAGE,
  164. null,
  165. dates,
  166. dates[30]);
  167. ChangeBirthday[1] = Day;
  168. return ChangeBirthday;
  169. }
  170.  
  171. public String[] Grade(String ChangeGrade[])
  172. {
  173. JFrame frame = new JFrame(""); //Question 3
  174.  
  175. //Drop down menu (combo box)
  176. Object[] Grades = {"Freshman",
  177. "Sophomore",
  178. "Junior",
  179. "Senior",};
  180. String GradeString = (String) JOptionPane.showInputDialog(frame,
  181. "What Grade are you in?",
  182. "Question 3",
  183. JOptionPane.QUESTION_MESSAGE,
  184. null,
  185. Grades,
  186. Grades[3]);
  187. ChangeGrade[2] = GradeString;
  188. return ChangeGrade;
  189. }
  190.  
  191. public String[] Gender(String ChangeGender[])
  192. {
  193. JFrame frame = new JFrame("What grade are you in?"); //Question 4
  194.  
  195. //Drop down menu (combo box)
  196. Object[] Genders = {"Male",
  197. "Female"};
  198. String Gender = (String) JOptionPane.showInputDialog(frame,
  199. "What is your gender?",
  200. "Question 4",
  201. JOptionPane.QUESTION_MESSAGE,
  202. null,
  203. Genders,
  204. Genders[1]);
  205. ChangeGender[3] = Gender;
  206. return ChangeGender;
  207. }
  208.  
  209.  
  210.  
  211. public String[] WhyHere(String ChangeWhyHere[])
  212. {
  213. JFrame frame = new JFrame(""); //Question 5
  214.  
  215. //Drop down menu (combo box)
  216. Object[] dates = {"Looking for a match",
  217. "Just having fun",
  218. "I lost a bet",};
  219. String Day = (String) JOptionPane.showInputDialog(frame,
  220. "Why are you looking to be paired with someone?",
  221. "Question 5",
  222. JOptionPane.QUESTION_MESSAGE,
  223. null,
  224. dates,
  225. dates[2]);
  226. ChangeWhyHere[4] = Day;
  227. return ChangeWhyHere;
  228. }
  229.  
  230. public String[] Look4InRel(String ChangeLook4InRel[])
  231. {
  232. JFrame frame = new JFrame(""); //Question 6
  233.  
  234. //Drop down menu (combo box)
  235. Object[] traits = {"Communicaton",
  236. "Trust",
  237. "Devotion",
  238. "Positivity",
  239. "Mutual Care",};
  240. String traitselect = (String) JOptionPane.showInputDialog(frame,
  241. "What do you most look for in a RELATIONSHIP?",
  242. "Question 6",
  243. JOptionPane.QUESTION_MESSAGE,
  244. null,
  245. traits,
  246. traits[4]);
  247. ChangeLook4InRel[5] = traitselect;
  248. return ChangeLook4InRel;
  249. }
  250.  
  251. public String[] ValTraits(String EditValTraits[])
  252. {
  253. JFrame frame = new JFrame(""); //Question 7
  254. Object[] traits = {"Humor",
  255. "Intelligence",
  256. "Loyalty",
  257. "Courage",
  258. "Ambition",};
  259. String traitselect = (String) JOptionPane.showInputDialog(frame,
  260. "What do you most look for among PEERS?",
  261. "Question 7",
  262. JOptionPane.QUESTION_MESSAGE,
  263. null,
  264. traits,
  265. traits[4]);
  266. EditValTraits[6] = traitselect;
  267. return EditValTraits;
  268. }
  269.  
  270. public String[] LoveLanguage(String ChangeLoveLanguage[])
  271. {
  272. JFrame frame = new JFrame(""); //Question 8
  273. Object[] languages = {"Quality Time",
  274. "Physical Touch",
  275. "Acts of Service",
  276. "Words of Affirmation",};
  277. String languageselect = (String) JOptionPane.showInputDialog(frame,
  278. "What love languge do you most identify with?",
  279. "Question 8",
  280. JOptionPane.QUESTION_MESSAGE,
  281. null,
  282. languages,
  283. languages[3]);
  284. ChangeLoveLanguage[7] = languageselect;
  285. return ChangeLoveLanguage;
  286. }
  287.  
  288. public String[] Spontaneous(String ChangeSpontaneous[])
  289. {
  290. JFrame frame = new JFrame(""); //Question 9
  291. Object[] spontaneous = {"1 - Not very spontaneous.",
  292. "2",
  293. "3 - Somewhat spontaneous",
  294. "4",
  295. "5 - Very spontaneous"};
  296.  
  297. String spontaneousrating = (String) JOptionPane.showInputDialog(frame,
  298. "How spontaneous would you say you are?",
  299. "Question 9",
  300. JOptionPane.QUESTION_MESSAGE,
  301. null,
  302. spontaneous,
  303. spontaneous[3]);
  304. ChangeSpontaneous[8] = spontaneousrating;
  305. return ChangeSpontaneous;
  306. }
  307.  
  308. public String[] HowOpen (String[] ChangeHowOpen)
  309. {
  310. JFrame frame = new JFrame("AnyThing"); //Question 10
  311. //Custom button text
  312. Object[] options = {"Incredibly Open",
  313. "More Open",
  314. "In the middle",
  315. "More Resilient",
  316. "Incredibly Resilient"};
  317. String HowOpen = (String) JOptionPane.showInputDialog(frame,
  318. "How open are you to new things?",
  319. "Question 10/20",
  320. JOptionPane.QUESTION_MESSAGE,
  321. null,
  322. options,
  323. options[4]);
  324. ChangeHowOpen[9] = HowOpen;
  325. return ChangeHowOpen;
  326. }
  327.  
  328. public String[] Politicz (String[] ChangePoliticz)
  329. {
  330. JFrame frame = new JFrame("AnyThing"); //Question 11
  331. //Custom button text
  332. Object[] options = {"1-Strongly Liberal",
  333. "2-Leaning Liberal",
  334. "3-Centrist",
  335. "4-Leaning Conservative",
  336. "5-Strongly Conservative"};
  337. String Politicz = (String) JOptionPane.showInputDialog(frame,
  338. "What are your political views in terms of Liberalism to Conservatism? 1-5",
  339. "Question 11/20",
  340. JOptionPane.QUESTION_MESSAGE,
  341. null,
  342. options,
  343. options[4]);
  344. ChangePoliticz[10] = Politicz;
  345. return ChangePoliticz;
  346. }
  347.  
  348. public String[] IdealDate (String[] IdealDateChange)
  349. {
  350. JFrame frame = new JFrame("AnyThing"); //Question 12
  351. //Custom button text
  352. Object[] options = {"Movies",
  353. "Dinner",
  354. "Video Games",
  355. "Chill",
  356. "Walk in the Park"};
  357. String IdealDate = (String) JOptionPane.showInputDialog(frame,
  358. "What does your ideal date look like?",
  359. "Question 12/20",
  360. JOptionPane.QUESTION_MESSAGE,
  361. null,
  362. options,
  363. options[4]);
  364. IdealDateChange[11] = IdealDate;
  365. return IdealDateChange;
  366. }
  367.  
  368. public String[] DueDate (String[] DueDateChange)
  369. {
  370. JFrame frame = new JFrame("AnyThing"); //Question 13
  371. //Custom button text
  372. Object[] options = {"Immediately.",
  373. "Later that night",
  374. "A few days after it's assigned",
  375. "A little bit before it's due.",
  376. "The morning of the day it's due."};
  377. String DueDate = (String) JOptionPane.showInputDialog(frame,
  378. "You have a large project due in 3 weeks, when do you do it?",
  379. "Question 13/20",
  380. JOptionPane.QUESTION_MESSAGE,
  381. null,
  382. options,
  383. options[4]);
  384. DueDateChange[12] = DueDate;
  385. return DueDateChange;
  386. }
  387.  
  388. public String[] PetLove (String[] ChangePetLove)
  389. {
  390. JFrame frame = new JFrame("AnyThing"); //Question 14
  391. //Custom button text
  392. Object[] options = {"1-Animal Worshiper",
  393. "2-I really like them",
  394. "3-They're okay",
  395. "4-I don't like them",
  396. "5-Dog Catcher"};
  397. String PetLove = (String) JOptionPane.showInputDialog(frame,
  398. "1-5 how much of a pet lover are you?",
  399. "Question 14/20",
  400. JOptionPane.QUESTION_MESSAGE,
  401. null,
  402. options,
  403. options[4]);
  404. ChangePetLove[13] = PetLove;
  405. return ChangePetLove;
  406. }
  407.  
  408. public String[] SaturdayNight (String[] ChangeSaturdayNight)
  409. {
  410. JFrame frame = new JFrame("AnyThing"); //Question 15
  411. //Custom button text
  412. Object[] options = {"Bright and Early",
  413. "Noon",
  414. "Night",
  415. "Midnight",
  416. "Whenever I Feel Like"};
  417. String SaturdayNight = (String) JOptionPane.showInputDialog(frame,
  418. "If you’re doing something on a saturday, when do you do it?",
  419. "Question 15/20",
  420. JOptionPane.QUESTION_MESSAGE,
  421. null,
  422. options,
  423. options[4]);
  424. ChangeSaturdayNight[14] = SaturdayNight;
  425. return ChangeSaturdayNight;
  426. }
  427.  
  428. public String[] Hobbies (String[] ChangeHobbies)
  429. {
  430. JFrame frame = new JFrame("AnyThing"); //Question 16
  431.  
  432. //Custom button text
  433. Object[] options = {"Video Games",
  434. "Supporting Local Community",
  435. "Arts And Crafts",
  436. "Netflix and Relax :^)",
  437. "DJ"};
  438. String Hobbies = (String) JOptionPane.showInputDialog(frame,
  439. "Which of these is your most enjoyed hobby?",
  440. "Question 16/20",
  441. JOptionPane.QUESTION_MESSAGE,
  442. null,
  443. options,
  444. options[4]);
  445. ChangeHobbies[15] = Hobbies;
  446. return ChangeHobbies;
  447. }
  448.  
  449. public String[] Vacation (String[] ChangeVacation)
  450. {
  451. JFrame frame = new JFrame("AnyThing"); //Question 17
  452.  
  453. //Custom button text
  454. Object[] options = {"Sports",
  455. "Relax",
  456. "Eat Good Food",
  457. "Discover New Cultures",
  458. "Go to 5-Star Restaurants"};
  459. String Vacation = (String) JOptionPane.showInputDialog(frame,
  460. "What would you like to do on a vacation?",
  461. "Question 17/20",
  462. JOptionPane.QUESTION_MESSAGE,
  463. null,
  464. options,
  465. options[4]);
  466. ChangeVacation[16] = Vacation;
  467. return ChangeVacation;
  468. }
  469.  
  470. public String[] Spend (String[] ChangeSpend)
  471. {
  472. JFrame frame = new JFrame("AnyThing"); //Question 18
  473.  
  474. //Custom button text
  475. Object[] options = {"Electronics Store",
  476. "Grocery Store",
  477. "Book Store",
  478. "JCPenny (clothes)",
  479. "Fancy Restaurant"};
  480. String Spend = (String) JOptionPane.showInputDialog(frame,
  481. "If you had $100 what store would you spend it in?",
  482. "Question 18/20",
  483. JOptionPane.QUESTION_MESSAGE,
  484. null,
  485. options,
  486. options[4]);
  487. ChangeSpend[17] = Spend;
  488. return ChangeSpend;
  489. }
  490.  
  491. public String[] Music (String[] ChangeMusic)
  492. {
  493. JFrame frame = new JFrame("AnyThing"); //Question 19
  494.  
  495. //Custom button text
  496. ImageIcon Icon = new ImageIcon("C:\\Users\\k.clancy\\Desktop\\Background.jpg");
  497. Object[] options = {"Country",
  498. "Rap",
  499. "Rock",
  500. "Electronic",
  501. "Jazz",
  502. "Classical"};
  503. String Music = (String) JOptionPane.showInputDialog(frame,
  504. "What is your least favorite type of music?",
  505. "Question 19/20",
  506. JOptionPane.QUESTION_MESSAGE,
  507. null,
  508. options,
  509. options[4]);
  510. ChangeMusic[18] = Music;
  511. return ChangeMusic;
  512. }
  513. /*
  514. public String[] Populated (String ChangePopulated[])
  515. {
  516. JFrame frame = new JFrame("AnyThing");
  517. //Custom button text
  518. Object[] options = {"1-Country",
  519. "2-Small City",
  520. "3-Fayetteville | Mid Sized City",
  521. "4-Above Average Sized City",
  522. "5-New York City | Very Large City"};
  523. String Populated = (String) JOptionPane.showInputDialog(frame,
  524. //change that to a string
  525. "How populated would you like your city that you live in to be?",
  526. "Question 20/20",
  527. JOptionPane.QUESTION_MESSAGE,
  528. null,
  529. options,
  530. options[3]);
  531. ChangePopulated[19] = Populated;
  532. //no need for a temp var, just use what jopt pulls
  533. return ChangePopulated;
  534. }
  535. */
  536.  
  537. public String[] HelloMatch (String[] ChangeHelloMatch)
  538. {
  539. JFrame frame = new JFrame("AnyThing"); //Question 20
  540.  
  541. //Custom button text
  542. Object[] options = {"Be my Valentine",
  543. "You are one of a kind",
  544. "Happy Valentines Day",
  545. "<3",
  546. "XOXOXO",
  547. "You are neat!",
  548. "Love is in the air",
  549. "Roses are Red, Violets are Blue",
  550. };
  551. String HelloMatch = (String) JOptionPane.showInputDialog(frame,
  552. "What message would you like to send to your match?",
  553. "Question 20/20",
  554. JOptionPane.QUESTION_MESSAGE,
  555. null,
  556. options,
  557. options[7]);
  558. ChangeHelloMatch[19] = HelloMatch;
  559. return ChangeHelloMatch;
  560. }
  561.  
  562. public void ReadInFile() throws FileNotFoundException
  563. {
  564. Valentines bob = new Valentines();
  565. /*
  566. try (Scanner ReaderTimes = new Scanner(new File("All.txt"))) //reads the All file
  567. {
  568.  
  569. String[][] AllData = new String[2634][19]; //array but has 2635
  570. // setting values to 0
  571. int counter = 0;
  572.  
  573. while (ReaderTimes.hasNextLine())
  574. {
  575. AllData [counter][] = (ReaderTimes.nextLine());
  576. // System.out.println(AllData[counter]);
  577. counter++;
  578. }
  579. }
  580. */
  581.  
  582. try (Scanner ReaderTimes = new Scanner(new File("Kios.txt"))) //reads the Kios file
  583. {
  584. String[] KiosDataWithCommas = new String[210];
  585. String[][] KiosData = new String[192][19]; //array but has 193
  586.  
  587.  
  588.  
  589. // setting values to 0
  590. int counter = 0;
  591. while (ReaderTimes.hasNextLine()) //CODE ONTO ARRAY
  592. {
  593. KiosDataWithCommas[counter] = ReaderTimes.nextLine();
  594. // System.out.println(KiosDataWithCommas[counter]);
  595. counter++;
  596. }
  597. counter = 0;
  598. String temporary;
  599.  
  600. for(int XX = 0; XX <189; XX++) //THIS TRANSFERS THE STUDENT ID
  601. {
  602. temporary = KiosDataWithCommas[XX].substring(0,5);
  603. KiosData[XX][0] = temporary;
  604. // System.out.println(temporary);
  605. }
  606.  
  607. int FirstPosition =6; int SecondPosition = 7; String TempString; //THIS IGNORES STUDENT ID
  608. for(int ZZ = 0; ZZ < 189; ZZ++) //THIS IS GOING TO TRANSFER THE OTHER 19 POSITIONS 6,7 to 8,9
  609. {
  610. FirstPosition=6;SecondPosition=7;
  611. for(int WW = 1; WW < 19; WW++)
  612. {
  613. TempString = KiosDataWithCommas[ZZ].substring(FirstPosition,SecondPosition); //TEMP STRING EXTRACTING
  614. KiosData[ZZ][WW] = TempString; //TRANSFER OF EXTRACTION TO MOTHER ARRAY
  615. FirstPosition+=2;SecondPosition+=2; //INCREASES COORDINATES FOR NEXT EXTRACTION
  616. }
  617. }
  618. bob.Sort_Into_Grades(KiosData);
  619.  
  620. } //end try
  621.  
  622. }
  623.  
  624. public void WriteToFile() throws FileNotFoundException, IOException
  625. {
  626. File fout = new File("out.txt");
  627. FileOutputStream fos = new FileOutputStream(fout);
  628. BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
  629.  
  630. for (int i = 0; i < 10; i++)
  631. {
  632. bw.write("");
  633. bw.newLine();
  634. }
  635.  
  636. bw.close();
  637. }
  638. /* list of names that can match odd balls with celebrities
  639. Lady Gaga
  640. Oprah
  641. Madonna
  642. Mark Cuban
  643. Shawn Mendes
  644. */
  645.  
  646.  
  647. public String[][] Sort_Into_Grades (String[][] KiosData)
  648. {
  649. Valentines AnnieBot = new Valentines();
  650. int Countaire1 = 0;
  651. int Countaire2 = 0;
  652. int Countaire3 = 0;
  653. int Countaire4 = 0;
  654.  
  655. for(int Counter = 0; Counter<189; Counter++) //WHILE LOOP TO COUNT HOW MANY ARE OF EACH GRADE
  656.  
  657. {
  658. String WhatGrade = KiosData[Counter][2];
  659. // System.out.println(WhatGrade);
  660.  
  661. if (WhatGrade.equals("1"))
  662. {
  663. Countaire1++;
  664.  
  665. }
  666. if (WhatGrade.equals("2"))
  667. {
  668. Countaire2++;
  669.  
  670. }
  671. if (WhatGrade.equals("3"))
  672. {
  673. Countaire3++;
  674.  
  675. }
  676. if (WhatGrade.equals("4"))
  677. {
  678. Countaire4++;
  679. }
  680. else if(WhatGrade.equals(null))
  681. {
  682. System.out.println("TRERE IS A NULL");
  683. }
  684. }
  685. /*
  686. System.out.println("HHHHHHHHHHHHHHHHHH");
  687. System.out.println(Countaire1);
  688. System.out.println(Countaire2);
  689. System.out.println(Countaire3);
  690. System.out.println(Countaire4);
  691. */
  692. System.out.println("This is the amount of Freshman Data: " +Countaire1);
  693. System.out.println("This is the amount of Sophomore Data: " +Countaire2);
  694. System.out.println("This is the amount of Junior Data: " +Countaire3);
  695. System.out.println("This is the amount of Senior Data: " +Countaire4);
  696. System.out.println("");
  697. System.out.println("26+ hours of my own free time later.. still getting out of bounds errors that kill my program");
  698. String[][] Grade1 = new String[Countaire1+10][19]; //MAKING ARRAYS BASED ON THE SIZE I FOUND OF GRADES
  699. String[][] Grade2 = new String[Countaire2+10][19];
  700. String[][] Grade3 = new String[Countaire3+10][19];
  701. String[][] Grade4 = new String[Countaire4+10][19];
  702.  
  703. Countaire1=0;Countaire2=0;Countaire3=0;Countaire4=0; // RESETS COUNTERS
  704.  
  705. for( int Counter = 0; Counter<189;Counter++) //THIS ARRAY MOVES THE PEOPLE INTO DIFFERENT ARRAYS
  706. {
  707. String WhatGrade = KiosData[Counter][2];
  708. if (WhatGrade.equals("1"))
  709. {
  710. // int Countaire1_For_Loop = 0;
  711. for (int Countaire1_For_Loop = 0;Countaire1_For_Loop<19;Countaire1_For_Loop++)
  712. {
  713. Grade1[Countaire1][Countaire1_For_Loop] = KiosData[Counter][Countaire1_For_Loop];
  714. }
  715. Countaire1++;
  716. }
  717.  
  718. //////////////////////////////
  719. if (WhatGrade.equals("2"))
  720. {
  721. int Countaire2_For_Loop = 0;
  722. for (int x = 0;x<19;x++)
  723. {
  724. Grade2[Countaire2][Countaire2_For_Loop] = KiosData[Counter][Countaire2_For_Loop];
  725. }
  726. Countaire2++;
  727. }
  728.  
  729. ///////////////////////////////
  730. if (WhatGrade.equals("3"))
  731. {
  732. int Countaire3_For_Loop = 0;
  733. for (int y = 0;y<19;y++)
  734. {
  735. Grade3[Countaire3][Countaire3_For_Loop] = KiosData[Counter][Countaire3_For_Loop];
  736. }
  737. Countaire3++;
  738. }
  739.  
  740. ///////////////////////////////////
  741. if (WhatGrade.equals("4"))
  742. {
  743. int Countaire4_For_Loop = 0;
  744. for (int z = 0;z<19;z++)
  745. {
  746. Grade4[Countaire1][Countaire4_For_Loop] = KiosData[Counter][Countaire4_For_Loop];
  747. // System.out.println(Grade4[Countaire1]);
  748. }
  749. }
  750. Countaire4++;
  751. Counter++;
  752. } //end copying people into different grade arrays! --
  753.  
  754.  
  755. //So now I'm going to print every array and make sure they're working ********************
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777. ////////////////////////////////THIS IS THE MATCHING PART OK?
  778.  
  779. /////////////////////////////// MATCHING FOR GRADE 1
  780. String TempPlaceHolder1 = "";
  781. String TempPlaceHolder2 = "";
  782. int CountMatchPoints = 0; //28 of 1, 75 of 2, 17 of 3, 69 of 4,
  783. int CountMatchPointsTry = 0;
  784. String[][] TempMatcher = new String[1][19]; //As of now my plan is to keep one string 1d data in this 2d array and then compare another thing in the second position of the array
  785. for(int Totes = 0; Totes < 27;Totes++) //THIS IS GOING TO LOOP THE MATCHER TO GRADE ROW LENGTH
  786. { //start For 1
  787. for(int a = 0; a <1;a++)
  788. { //start For 2
  789. for(int b = 0; b <19;b++)
  790. { //Start For 3
  791. TempMatcher[a][b] = Grade1[a][b];
  792. } //End For 3
  793. //System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGH" + TempMatcher[0][19]);
  794. } //End For 2
  795. ///As of now the 2 pieces of data are in the array, we will begin to match the first piece of data and find the CountMatchPoints score.
  796. TempPlaceHolder1 = "";
  797. TempPlaceHolder2 = "";
  798. for(int Column =0; Column<19;Column++)
  799. {//Start For 4
  800. TempPlaceHolder1 = TempMatcher[0][Column];
  801. // TempPlaceHolder2 = TempMatcher[1][Column];
  802. if (TempPlaceHolder1.equals(TempPlaceHolder2))
  803. {
  804. CountMatchPointsTry++;
  805. //System.out.println(CountMatchPointsTry);
  806. }
  807. }//End For 4
  808.  
  809. //Insert if-statement shit regarding counter points
  810. if (CountMatchPoints < CountMatchPointsTry)
  811. {
  812. System.out.println("Altered Best Match!");
  813. CountMatchPoints = CountMatchPointsTry;
  814. int BestMarkForMatch = Totes;
  815. }
  816.  
  817. } //End For 1
  818.  
  819. return KiosData;
  820. } //END METHOD
  821.  
  822. } //END CLASS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement