Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.92 KB | None | 0 0
  1. static String[] Q = new String[30];{
  2. Q[0] = "Which of the following is a requirement in order to vote in a Canadian federal election?";
  3. Q[1] = "What major sporting event was held in Canada in 2010?";
  4. Q[2] = "Which of the following is not a province of Canada?";
  5. Q[3] = "Who was the first Prime Minister of Canada? ";
  6. Q[4] = "How many Oceans border Canada? ";
  7. Q[5] = "What is the status of Canada? ";
  8. Q[6] = "Which of the following islands is not part of Canada? ";
  9. Q[7] = "Which is the longest river in Canada? ";
  10. Q[8] = "Which Canadian province is the country’s largest producer and exporter of maple syrup? ";
  11. Q[9] = "Who donated the Stanley Cup to the National Hockey League? ";
  12. Q[10] = "Why did Ottawa establish the Mounted Police in 1873? ";
  13. Q[11] = "Which famous Canadian composed the Canadian national anthem? ";
  14. Q[12] = "Who is the Head of State of Canada? ";
  15. Q[13] = "Who after winning gold medal in 100 metres race in Seoul Olympics 1988 tested positive for drugs and was thrown out? ";
  16. Q[14] = "What university developed the world’s first anti-gravity suit? ";
  17. Q[15] = "O Canada! Our home and ______ land!";
  18. Q[16] = "Red and _____ are the national colours of Canada.";
  19. Q[17] = "The national animal of Canada is the ______ .";
  20. Q[18] = "Lacrosse is Canada’s national summer sport, _____ is the national winter sport.";
  21. Q[19] = "English and ______ are Canada’s national languages.";
  22. Q[20] = "The _____ leaf is featured on Canada’s national flag.";
  23. Q[21] = "Royal Canadian _______ Police are the federal police force of Canada.";
  24. Q[22] = "Canada’s newest territory is _______ .";
  25. Q[23] = "Canada celebrates its independence on ____ 1st every year.";
  26. Q[24] = "On one side of a quarter in The Queen, on the other side is a _____ .";
  27. Q[25] = "Wilfrid _______ is the man on the $5 bill.";
  28. Q[26] = "The name Canada originally meant _______ or settlement.";
  29. Q[27] = "The $2 coin of Canada is called a Toonie, the $1 coin is called a ______ .";
  30. Q[28] = "Mount _____ is the highest mountain in Canada.";
  31. Q[29] = "In Canada you may not publicly remove a ________ . ";}
  32.  
  33. static String[] optionA = new String[15];{
  34.  
  35. optionA[0]= " a) Your are at least 18 years old on election day";
  36. optionA[1]= " a) Summer Olympics ";
  37. optionA[2]= " a) Alberta ";
  38. optionA[3]= " a) Alexander Mackenzie ";
  39. optionA[4]= " a) 1";
  40. optionA[5]= " a) Republic";
  41. optionA[6]= " a) Greenland";
  42. optionA[7]= " a) St. Lawrence";
  43. optionA[8]= " a) Ontario";
  44. optionA[9]= " a) Bill Stanley";
  45. optionA[10]=" a) To perform equestrian shows";
  46. optionA[11]=" a) Ceiline Dion";
  47. optionA[12]=" a) President";
  48. optionA[13]=" a) Donovan Bailey";
  49. optionA[14]=" a) University of Toronto";}
  50.  
  51. static String[] optionB = new String [15];{
  52.  
  53. optionB[0]= " b) You are a Canadian citizen" ;
  54. optionB[1]= " b) Winter Olympics";
  55. optionB[2]= " b) British Columbia";
  56. optionB[3]= " b) John A. MacDonald";
  57. optionB[4]= " b) 2";
  58. optionB[5]= " b) Dominion";
  59. optionB[6]= " b) Baffin Island";
  60. optionB[7]= " b) Mackenzie";
  61. optionB[8]= " b) British Columbia";
  62. optionB[9]= " b) Governor General Lord Stanley";
  63. optionB[10]= " b) To pacify the West and negotiate with the Indians";
  64. optionB[11]= " b) Calixa Lavallee";
  65. optionB[12]= " b) Governor General";
  66. optionB[13]= " b) Ben Johnson";
  67. optionB[14]= " b) Simon Fraser University"; }
  68.  
  69. static String[] optionC = new String [15];{
  70.  
  71. optionC[0]= " c) You can prove your identity and address";
  72. optionC[1]= " c) World Cup ";
  73. optionC[2]= " c) Rhode Island ";
  74. optionC[3]= " c) Louis Riel ";
  75. optionC[4]= " c) 3 ";
  76. optionC[5]= " c) Kingdom ";
  77. optionC[6]= " c) Victoria Island ";
  78. optionC[7]= " c) Nelson ";
  79. optionC[8]= " c) Quebec ";
  80. optionC[9]= " c) Stanley Lord ";
  81. optionC[10]= " c) To arrest Louis Riel ";
  82. optionC[11]= " c) Bryan Adams ";
  83. optionC[12]= " c) Monarch of United Kingdom ";
  84. optionC[13]= " c) Carl Lewis ";
  85. optionC[14]= " c) University of British Columbia "; }
  86.  
  87.  
  88. static String[] optionD = new String [15];{
  89.  
  90.  
  91. optionD[0]= " d) All of the above";
  92. optionD[1]= " d) Commonwealth Games ";
  93. optionD[2]= " d) Quebec ";
  94. optionD[3]= " d) Wilfred Laurier ";
  95. optionD[4]= " d) 4 ";
  96. optionD[5]= " d) Commonwealth ";
  97. optionD[6]= " d) Prince Edward Island ";
  98. optionD[7]= " d) Fraser ";
  99. optionD[8]= " d) New Brunswick ";
  100. optionD[9]= " d) Stanley Bill ";
  101. optionD[10]= " d) To drive the Metis out of Canada ";
  102. optionD[11]= " d) Gordon Lightfoot ";
  103. optionD[12]= " d) Prime Minister ";
  104. optionD[13]= " d) Roger Bannister ";
  105. optionD[14]= " d) Queen’s University "; }
  106.  
  107. static String[] answer = new String [30];{
  108.  
  109. answer[0]= "D";
  110. answer[1]= "B";
  111. answer[2]= "C";
  112. answer[3]= "B";
  113. answer[4]= "C";
  114. answer[5]= "B";
  115. answer[6]= "A";
  116. answer[7]= "B";
  117. answer[8]= "C";
  118. answer[9]= "B";
  119. answer[10]= "B";
  120. answer[11]= "B";
  121. answer[12]= "C";
  122. answer[13]= "C";
  123. answer[14]= "A";
  124. answer[15]= "native";
  125. answer[16]= "white" ;
  126. answer[17]= "beaver" ;
  127. answer[18]= "hockey";
  128. answer[19]= "French";
  129. answer[20]= "maple";
  130. answer[21]= "Mounted";
  131. answer[22]= "Nunavut";
  132. answer[23]= "July";
  133. answer[24]= "moose";
  134. answer[25]= "Laurier";
  135. answer[26]= "village";
  136. answer[27]= "Loonie";
  137. answer[28]= "Logan";
  138. answer[29]= "Band-Aid";}
  139.  
  140.  
  141.  
  142. //first screen to be seen, asks user if they would like to open tutorial window
  143. public static void introScreen(){ //Main Programmer: Amarnath Parthiban
  144.  
  145. JPanel introScreen = new JPanel();
  146. introScreen.setLayout(null);
  147.  
  148. final JFrame introFrame = new JFrame("Welcome");
  149. introFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  150. introFrame.add(introScreen);
  151.  
  152. //text to be displayed on screen
  153. JLabel introTitle = new JLabel("So you think you're Canadian, eh?");
  154. introTitle.setFont(new Font("Calibri", Font.PLAIN, 20));
  155. introTitle.setBounds(5, 0, 500, 25);
  156.  
  157. JLabel introText1 = new JLabel("Welcome to the CIA Canadian trivia quiz.");
  158. introText1.setFont(new Font("Calibri", Font.PLAIN, 16));
  159. introText1.setBounds(15, 25, 500, 25);
  160.  
  161. JLabel introText2 = new JLabel("Would you like to take the tutorial?");
  162. introText2.setFont(new Font("Calibri", Font.PLAIN, 16));
  163. introText2.setBounds(25, 50, 500, 25);
  164.  
  165. //buttons for user input
  166. JButton yesTutorial = new JButton("YES");
  167. yesTutorial.setFont(new Font("Calibri", Font.PLAIN, 16));
  168. yesTutorial.setBounds(55, 75, 70, 30);
  169.  
  170. JButton noTutorial = new JButton("NO");
  171. noTutorial.setFont(new Font("Calibri", Font.PLAIN, 16));
  172. noTutorial.setBounds(165, 75, 70, 30);
  173.  
  174. introScreen.add(introTitle);
  175. introScreen.add(introText1);
  176. introScreen.add(introText2);
  177. introScreen.add(yesTutorial);
  178. introScreen.add(noTutorial);
  179.  
  180. introFrame.setSize(310,160);
  181. introFrame.setVisible(true);
  182.  
  183. yesTutorial.addActionListener(new ActionListener(){
  184.  
  185. public void actionPerformed(ActionEvent e){
  186.  
  187. //removes first window and opens the tutorial window
  188. introFrame.dispose();
  189. tutorial();
  190.  
  191. }
  192. });
  193.  
  194. noTutorial.addActionListener(new ActionListener(){
  195.  
  196. public void actionPerformed(ActionEvent e){
  197.  
  198. //removes first window and opens main quiz window
  199. introFrame.dispose();
  200. quiz();
  201.  
  202. }
  203. });
  204.  
  205. }
  206.  
  207. //static panel and frame to allow only one instance of the window to be open
  208. static JPanel mainQuiz = new JPanel();
  209. static JFrame mainFrame = new JFrame("CAI Quiz");
  210. static CardLayout card1 = new CardLayout();
  211.  
  212. //used to determine if the main quiz screen is open, defaulted to false for safety
  213. static boolean quizState = false;
  214.  
  215. public static void quiz(){ //Main Programmer: Amarnath Parthiban
  216.  
  217. mainQuiz.setLayout(card1);
  218. mainFrame.add(mainQuiz);
  219.  
  220. JPanel quiz = new JPanel();
  221. //allows use of (x,y) positions on JPanel
  222. quiz.setLayout(null);
  223.  
  224. //changes the state to inform that main quiz is open and other windows can be closed without ending the program
  225. quizState = true;
  226.  
  227. mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  228. mainQuiz.add(quiz, "a");
  229.  
  230. //title
  231. JLabel mainTitle = new JLabel("CAI CANADIAN QUIZ");
  232. mainTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  233. mainTitle.setBounds(190, 25, 700, 60);
  234.  
  235. //buttons for each question type and level including a random and tutorial button
  236. JButton MCLevel1 = new JButton("Multiple Choice Level 1");
  237. MCLevel1.setFont(new Font("Calibri", Font.PLAIN, 25));
  238. MCLevel1.setBounds(150, 200, 300, 100);
  239.  
  240. JButton MCLevel2 = new JButton("Multiple Choice Level 2");
  241. MCLevel2.setFont(new Font("Calibri", Font.PLAIN, 25));
  242. MCLevel2.setBounds(150, 350, 300, 100);
  243.  
  244. JButton MCLevel3 = new JButton("Multiple Choice Level 3");
  245. MCLevel3.setFont(new Font("Calibri", Font.PLAIN, 25));
  246. MCLevel3.setBounds(150, 500, 300, 100);
  247.  
  248. JButton FIBLevel1 = new JButton("Fill in The Blank Level 1");
  249. FIBLevel1.setFont(new Font("Calibri", Font.PLAIN, 25));
  250. FIBLevel1.setBounds(550, 200, 300, 100);
  251.  
  252. JButton FIBLevel2 = new JButton("Fill in The Blank Level 2");
  253. FIBLevel2.setFont(new Font("Calibri", Font.PLAIN, 25));
  254. FIBLevel2.setBounds(550, 350, 300, 100);
  255.  
  256. JButton FIBLevel3 = new JButton("Fill in The Blank Level 3");
  257. FIBLevel3.setFont(new Font("Calibri", Font.PLAIN, 25));
  258. FIBLevel3.setBounds(550, 500, 300, 100);
  259.  
  260. JButton random = new JButton("Random");
  261. random.setFont(new Font("Calibri", Font.PLAIN, 25));
  262. random.setBounds(350, 650, 300, 100);
  263.  
  264. JButton tutorial = new JButton("Tutorial");
  265. tutorial.setFont(new Font("Calibri", Font.PLAIN, 20));
  266. tutorial.setBounds(10, 650, 100, 100);
  267.  
  268. quiz.add(mainTitle);
  269. quiz.add(MCLevel1);
  270. quiz.add(MCLevel2);
  271. quiz.add(MCLevel3);
  272. quiz.add(FIBLevel1);
  273. quiz.add(FIBLevel2);
  274. quiz.add(FIBLevel3);
  275. quiz.add(random);
  276. quiz.add(tutorial);
  277.  
  278. mainFrame.setSize(1000,800);
  279. mainFrame.setVisible(true);
  280. card1.show(mainQuiz, "a");
  281.  
  282. MCLevel1.addActionListener(new ActionListener(){
  283.  
  284. public void actionPerformed(ActionEvent e){
  285.  
  286. MCLevel1();
  287.  
  288. }
  289. });
  290.  
  291. MCLevel2.addActionListener(new ActionListener(){
  292.  
  293. public void actionPerformed(ActionEvent e){
  294.  
  295. MCLevel2();
  296.  
  297. }
  298. });
  299.  
  300. MCLevel3.addActionListener(new ActionListener(){
  301.  
  302. public void actionPerformed(ActionEvent e){
  303.  
  304. MCLevel3();
  305.  
  306. }
  307. });
  308.  
  309. FIBLevel1.addActionListener(new ActionListener(){
  310.  
  311. public void actionPerformed(ActionEvent e){
  312.  
  313. FIBLevel1();
  314.  
  315. }
  316. });
  317.  
  318. FIBLevel2.addActionListener(new ActionListener(){
  319.  
  320. public void actionPerformed(ActionEvent e){
  321.  
  322. FIBLevel2();
  323.  
  324. }
  325. });
  326.  
  327. FIBLevel3.addActionListener(new ActionListener(){
  328.  
  329. public void actionPerformed(ActionEvent e){
  330.  
  331. FIBLevel3();
  332.  
  333. }
  334. });
  335.  
  336. tutorial.addActionListener(new ActionListener(){
  337.  
  338. public void actionPerformed(ActionEvent e){
  339.  
  340. //allows user to open tutorial when needed
  341. tutorial();
  342.  
  343. }
  344. });
  345.  
  346. }
  347.  
  348. static int x;
  349. public static void MCLevel1(){ //Main Programmer: Amarnath Parthiban
  350.  
  351. final JPanel MC1 = new JPanel();
  352. MC1.setLayout(null);
  353.  
  354. mainQuiz.add(MC1, "b");
  355.  
  356. JLabel MC1Title = new JLabel("Multiple Choice Level 1");
  357. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 50));
  358. MC1Title.setBounds(10, -30, 700, 120);
  359.  
  360. JLabel sessionScore = new JLabel("Session Score: N/A");
  361. sessionScore.setFont(new Font("Calibri", Font.PLAIN, 25));
  362. sessionScore.setBounds(710, 650, 300, 120);
  363.  
  364. JButton MC1Back = new JButton("Return");
  365. MC1Back.setFont(new Font("Calibri", Font.PLAIN, 32));
  366. MC1Back.setBounds(5, 650, 300, 100);
  367.  
  368. JLabel question = new JLabel();
  369. JRadioButton A = new JRadioButton();
  370. JRadioButton B = new JRadioButton();
  371. JRadioButton C = new JRadioButton();
  372. JRadioButton D = new JRadioButton();
  373.  
  374. for (x = 0; x <= 5; x++){
  375.  
  376. question.setText(Q[x]);
  377. question.setFont(new Font("Calibri", Font.PLAIN, 15));
  378. question.setBounds(110, 150, 270, 70);
  379.  
  380. A.setText(optionA[x]);
  381. A.setBounds(115, 240, 100, 10);
  382. A.setActionCommand("A");
  383.  
  384. B.setText(optionB[x]);
  385. B.setBounds(115, 255, 100, 10);
  386. B.setActionCommand("B");
  387.  
  388. C.setText(optionC[x]);
  389. C.setBounds(115, 270, 100, 10);
  390. C.setActionCommand("C");
  391.  
  392. D.setText(optionD[x]);
  393. D.setBounds(115, 285, 100, 10);
  394. D.setActionCommand("D");
  395.  
  396. ButtonGroup Q1Group = new ButtonGroup();
  397. Q1Group.add(A);
  398. Q1Group.add(B);
  399. Q1Group.add(C);
  400. Q1Group.add(D);
  401.  
  402. JButton submit = new JButton("Submit");
  403. submit.setFont(new Font("Calibri", Font.PLAIN, 32));
  404. submit.setBounds(205, 450, 300, 100);
  405.  
  406. MC1.add(MC1Title);
  407. MC1.add(question);
  408. MC1.add(MC1Back);
  409. MC1.add(A);
  410. MC1.add(B);
  411. MC1.add(C);
  412. MC1.add(D);
  413. MC1.add(sessionScore);
  414. MC1.add(submit);
  415.  
  416. card1.show(mainQuiz, "b");
  417.  
  418. MC1Back.addActionListener(new ActionListener(){
  419.  
  420. public void actionPerformed(ActionEvent e){
  421.  
  422. quiz();
  423.  
  424. }
  425. });
  426.  
  427. A.addActionListener(new ActionListener(){
  428.  
  429. public void actionPerformed(ActionEvent e){
  430.  
  431. //check result (int questionNumber)
  432.  
  433. }
  434. });
  435.  
  436. B.addActionListener(new ActionListener(){
  437.  
  438. public void actionPerformed(ActionEvent e){
  439.  
  440. //check result (int questionNumber)
  441.  
  442. }
  443. });
  444.  
  445. C.addActionListener(new ActionListener(){
  446.  
  447. public void actionPerformed(ActionEvent e){
  448.  
  449. //check result (int questionNumber)
  450.  
  451. }
  452. });
  453.  
  454.  
  455. D.addActionListener(new ActionListener(){
  456.  
  457. public void actionPerformed(ActionEvent e){
  458.  
  459. //check result (int questionNumber)
  460.  
  461. }
  462. });
  463.  
  464. //evaluate
  465.  
  466. }
  467. }
  468.  
  469. public static void MCLevel2(){ //Main Programmer: Amarnath Parthiban
  470.  
  471. JPanel MC2 = new JPanel();
  472. MC2.setLayout(null);
  473.  
  474. mainQuiz.add(MC2, "c");
  475.  
  476. JLabel MC1Title = new JLabel("Score");
  477. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
  478. MC1Title.setBounds(380, 25, 700, 120);
  479.  
  480. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  481. + " On the main menu your score will be displayed once as your overall score."
  482. + " When in a session your total score as well as your session score will be visible."
  483. + " These scores will automaticly updated as you continue on with your session."
  484. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  485. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  486. scoreDescription.setBounds(150, 50, 700, 500);
  487.  
  488. JButton scoreBack = new JButton("Return");
  489. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  490. scoreBack.setBounds(350, 600, 300, 100);
  491.  
  492. MC2.add(MC1Title);
  493. MC2.add(scoreDescription);
  494. MC2.add(scoreBack);
  495.  
  496. card1.show(mainQuiz, "c");
  497.  
  498. scoreBack.addActionListener(new ActionListener(){
  499.  
  500. public void actionPerformed(ActionEvent e){
  501.  
  502. quiz();
  503.  
  504. }
  505. });
  506.  
  507. }
  508.  
  509. public static void MCLevel3(){ //Main Programmer: Amarnath Parthiban
  510.  
  511. JPanel MC3 = new JPanel();
  512. MC3.setLayout(null);
  513.  
  514. mainQuiz.add(MC3, "d");
  515.  
  516. JLabel MC1Title = new JLabel("Score");
  517. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
  518. MC1Title.setBounds(380, 25, 700, 120);
  519.  
  520. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  521. + " On the main menu your score will be displayed once as your overall score."
  522. + " When in a session your total score as well as your session score will be visible."
  523. + " These scores will automaticly updated as you continue on with your session."
  524. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  525. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  526. scoreDescription.setBounds(150, 50, 700, 500);
  527.  
  528. JButton scoreBack = new JButton("Return");
  529. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  530. scoreBack.setBounds(350, 600, 300, 100);
  531.  
  532. MC3.add(MC1Title);
  533. MC3.add(scoreDescription);
  534. MC3.add(scoreBack);
  535.  
  536. card1.show(mainQuiz, "d");
  537.  
  538. scoreBack.addActionListener(new ActionListener(){
  539.  
  540. public void actionPerformed(ActionEvent e){
  541.  
  542. quiz();
  543.  
  544. }
  545. });
  546.  
  547. }
  548.  
  549. public static void FIBLevel1(){ //Main Programmer: Amarnath Parthiban
  550.  
  551. JPanel FIB1 = new JPanel();
  552. FIB1.setLayout(null);
  553.  
  554. mainQuiz.add(FIB1, "e");
  555.  
  556. JLabel MC1Title = new JLabel("Score");
  557. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
  558. MC1Title.setBounds(380, 25, 700, 120);
  559.  
  560. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  561. + " On the main menu your score will be displayed once as your overall score."
  562. + " When in a session your total score as well as your session score will be visible."
  563. + " These scores will automaticly updated as you continue on with your session."
  564. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  565. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  566. scoreDescription.setBounds(150, 50, 700, 500);
  567.  
  568. JButton scoreBack = new JButton("Return");
  569. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  570. scoreBack.setBounds(350, 600, 300, 100);
  571.  
  572. FIB1.add(MC1Title);
  573. FIB1.add(scoreDescription);
  574. FIB1.add(scoreBack);
  575.  
  576. card1.show(mainQuiz, "e");
  577.  
  578. scoreBack.addActionListener(new ActionListener(){
  579.  
  580. public void actionPerformed(ActionEvent e){
  581.  
  582. quiz();
  583.  
  584. }
  585. });
  586.  
  587. }
  588.  
  589. public static void FIBLevel2(){ //Main Programmer: Amarnath Parthiban
  590.  
  591. JPanel FIB2 = new JPanel();
  592. FIB2.setLayout(null);
  593.  
  594. mainQuiz.add(FIB2, "f");
  595.  
  596. JLabel MC1Title = new JLabel("Score");
  597. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
  598. MC1Title.setBounds(380, 25, 700, 120);
  599.  
  600. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  601. + " On the main menu your score will be displayed once as your overall score."
  602. + " When in a session your total score as well as your session score will be visible."
  603. + " These scores will automaticly updated as you continue on with your session."
  604. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  605. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  606. scoreDescription.setBounds(150, 50, 700, 500);
  607.  
  608. JButton scoreBack = new JButton("Return");
  609. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  610. scoreBack.setBounds(350, 600, 300, 100);
  611.  
  612. FIB2.add(MC1Title);
  613. FIB2.add(scoreDescription);
  614. FIB2.add(scoreBack);
  615.  
  616. card1.show(mainQuiz, "f");
  617.  
  618. scoreBack.addActionListener(new ActionListener(){
  619.  
  620. public void actionPerformed(ActionEvent e){
  621.  
  622. quiz();
  623.  
  624. }
  625. });
  626.  
  627. }
  628.  
  629. public static void FIBLevel3(){ //Main Programmer: Amarnath Parthiban
  630.  
  631. JPanel FIB3 = new JPanel();
  632. FIB3.setLayout(null);
  633.  
  634. mainQuiz.add(FIB3, "g");
  635.  
  636. JLabel MC1Title = new JLabel("Score");
  637. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
  638. MC1Title.setBounds(380, 25, 700, 120);
  639.  
  640. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  641. + " On the main menu your score will be displayed once as your overall score."
  642. + " When in a session your total score as well as your session score will be visible."
  643. + " These scores will automaticly updated as you continue on with your session."
  644. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  645. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  646. scoreDescription.setBounds(150, 50, 700, 500);
  647.  
  648. JButton scoreBack = new JButton("Return");
  649. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 75));
  650. scoreBack.setBounds(350, 600, 300, 100);
  651.  
  652. FIB3.add(MC1Title);
  653. FIB3.add(scoreDescription);
  654. FIB3.add(scoreBack);
  655.  
  656. card1.show(mainQuiz, "g");
  657.  
  658. scoreBack.addActionListener(new ActionListener(){
  659.  
  660. public void actionPerformed(ActionEvent e){
  661.  
  662. quiz();
  663.  
  664. }
  665. });
  666.  
  667. }
  668.  
  669. //static panel and frame to allow only one instance of the window to be open
  670. static JPanel mainTutorial = new JPanel();
  671. static JFrame tutorialFrame = new JFrame("Tutorial");
  672.  
  673. //allows for multiple JPanels on one JFrame
  674. static CardLayout card2 = new CardLayout();
  675.  
  676. public static void tutorial(){ //Main Programmer: Amarnath Parthiban
  677.  
  678. mainTutorial.setLayout(card2);
  679. tutorialFrame.add(mainTutorial);
  680.  
  681. //additional panel to set on top and interchange between other panels
  682. JPanel tutorial = new JPanel();
  683. tutorial.setLayout(null);
  684.  
  685. mainTutorial.add(tutorial, "one");
  686.  
  687. //determine if the tutorial window needs to stop the program or not
  688. if (quizState == true)
  689. tutorialFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  690. else
  691. tutorialFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  692.  
  693. //title for the panel
  694. JLabel tutorialTitle = new JLabel("Tutorial");
  695. tutorialTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  696. tutorialTitle.setBounds(380, 25, 700, 60);
  697.  
  698. //buttons for each topic, including a quiz button
  699. JButton score = new JButton("Score");
  700. score.setFont(new Font("Calibri", Font.PLAIN, 32));
  701. score.setBounds(150, 200, 300, 100);
  702.  
  703. JButton level = new JButton("Level");
  704. level.setFont(new Font("Calibri", Font.PLAIN, 32));
  705. level.setBounds(150, 400, 300, 100);
  706.  
  707. JButton type = new JButton("Type");
  708. type.setFont(new Font("Calibri", Font.PLAIN, 32));
  709. type.setBounds(550, 200, 300, 100);
  710.  
  711. JButton answering = new JButton("Answering");
  712. answering.setFont(new Font("Calibri", Font.PLAIN, 32));
  713. answering.setBounds(550, 400, 300, 100);
  714.  
  715. JButton main = new JButton("QUIZ SCREEN");
  716. main.setFont(new Font("Calibri", Font.PLAIN, 32));
  717. main.setBounds(350, 600, 300, 100);
  718.  
  719. tutorial.add(tutorialTitle);
  720. tutorial.add(score);
  721. tutorial.add(level);
  722. tutorial.add(type);
  723. tutorial.add(answering);
  724. tutorial.add(main);
  725.  
  726. tutorialFrame.setSize(1000,800);
  727. tutorialFrame.setVisible(true);
  728.  
  729. //displays the home tutorial panel
  730. card2.show(mainTutorial, "one");
  731.  
  732. //calling methods for each of the topics depending on button pushed
  733. score.addActionListener(new ActionListener(){
  734.  
  735. public void actionPerformed(ActionEvent e){
  736.  
  737. score();
  738.  
  739. }
  740. });
  741.  
  742. level.addActionListener(new ActionListener(){
  743.  
  744. public void actionPerformed(ActionEvent e){
  745.  
  746. level();
  747.  
  748. }
  749. });
  750.  
  751. type.addActionListener(new ActionListener(){
  752.  
  753. public void actionPerformed(ActionEvent e){
  754.  
  755. type();
  756.  
  757. }
  758. });
  759.  
  760. answering.addActionListener(new ActionListener(){
  761.  
  762. public void actionPerformed(ActionEvent e){
  763.  
  764. answering();
  765.  
  766. }
  767. });
  768.  
  769. main.addActionListener(new ActionListener(){
  770.  
  771. public void actionPerformed(ActionEvent e){
  772.  
  773. //open the quiz window, make the tutoral window disposible without ending the program
  774. tutorialFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  775. quiz();
  776.  
  777. }
  778. });
  779.  
  780. }
  781.  
  782. //START: methods used by the tutorial screen exclusively
  783.  
  784. //each method contains a title, a brief description and a button to return to the main tutorial screen
  785. public static void score(){ //Main Programmer: Amarnath Parthiban
  786.  
  787. JPanel scoreTutorial = new JPanel();
  788. scoreTutorial.setLayout(null);
  789.  
  790. mainTutorial.add(scoreTutorial, "two");
  791.  
  792. JLabel scoreTitle = new JLabel("Score");
  793. scoreTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  794. scoreTitle.setBounds(380, 25, 700, 120);
  795.  
  796. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  797. + " On the main menu your score will be displayed once as your overall score."
  798. + " When in a session your total score as well as your session score will be visible."
  799. + " These scores will automaticly updated as you continue on with your session."
  800. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  801. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  802. scoreDescription.setBounds(150, 50, 700, 500);
  803.  
  804. JButton scoreBack = new JButton("Return");
  805. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  806. scoreBack.setBounds(350, 600, 300, 100);
  807.  
  808. scoreTutorial.add(scoreTitle);
  809. scoreTutorial.add(scoreDescription);
  810. scoreTutorial.add(scoreBack);
  811.  
  812. card2.show(mainTutorial, "two");
  813.  
  814. scoreBack.addActionListener(new ActionListener(){
  815.  
  816. public void actionPerformed(ActionEvent e){
  817.  
  818. tutorial();
  819.  
  820. }
  821. });
  822.  
  823. }
  824.  
  825. public static void level(){ //Main Programmer: Amarnath Parthiban
  826.  
  827. JPanel levelTutorial = new JPanel();
  828. levelTutorial.setLayout(null);
  829.  
  830. mainTutorial.add(levelTutorial, "three");
  831.  
  832. JLabel levelTitle = new JLabel("Level");
  833. levelTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  834. levelTitle.setBounds(380, 25, 700, 120);
  835.  
  836. JLabel levelDescription = new JLabel("<html> Every type has 3 levels; easy, medium and hard."
  837. + " The easy questions are basic questions, the answers to these questions should come from the top of you head."
  838. + " Medium-leveled questions modertaley difficult. They require some background knowledge of Canada."
  839. + " In each level, there will be five questions."
  840. + " After answering a new one , under the same level will appear. "
  841. + " The hard questions have a high difficulty rating. You will need to know every inch of Canadian history, geography and culture."
  842. + " Don't worry about the level. I think you can do it. </html>");
  843. levelDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  844. levelDescription.setBounds(150, 50, 700, 500);
  845.  
  846. JButton levelBack = new JButton("Return");
  847. levelBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  848. levelBack.setBounds(350, 600, 300, 100);
  849.  
  850. levelTutorial.add(levelTitle);
  851. levelTutorial.add(levelDescription);
  852. levelTutorial.add(levelBack);
  853.  
  854. card2.show(mainTutorial, "three");
  855.  
  856. levelBack.addActionListener(new ActionListener(){
  857.  
  858. public void actionPerformed(ActionEvent e){
  859.  
  860. tutorial();
  861.  
  862. }
  863. });
  864.  
  865. }
  866.  
  867. public static void type(){ //Main Programmer: Amarnath Parthiban
  868.  
  869. JPanel typeTutorial = new JPanel();
  870. typeTutorial.setLayout(null);
  871.  
  872. mainTutorial.add(typeTutorial, "four");
  873.  
  874. JLabel typeTitle = new JLabel("Type");
  875. typeTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  876. typeTitle.setBounds(380, 25, 700, 120);
  877.  
  878. JLabel typeDescription = new JLabel("<html>In this quiz, there are three types of questions; multiple choice, fill in the blanks and random."
  879. + " If you choose a multiple choice question the options will be given to you along with the question ."
  880. + " The fill in the blanks will require you to type in the missing word of the phrase."
  881. + " Random is a type where the computer chooses a question type for you and."
  882. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  883. typeDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  884. typeDescription.setBounds(150, 50, 700, 500);
  885.  
  886. JButton typeBack = new JButton("Return");
  887. typeBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  888. typeBack.setBounds(350, 600, 300, 100);
  889.  
  890. typeTutorial.add(typeTitle);
  891. typeTutorial.add(typeDescription);
  892. typeTutorial.add(typeBack);
  893.  
  894. card2.show(mainTutorial, "four");
  895.  
  896. typeBack.addActionListener(new ActionListener(){
  897.  
  898. public void actionPerformed(ActionEvent e){
  899.  
  900. tutorial();
  901.  
  902. }
  903. });
  904.  
  905. }
  906.  
  907. public static void answering(){ //Main Programmer: Amarnath Parthiban
  908.  
  909. JPanel answeringTutorial = new JPanel();
  910. answeringTutorial.setLayout(null);
  911.  
  912. mainTutorial.add(answeringTutorial, "five");
  913.  
  914. JLabel answeringTitle = new JLabel("Answering");
  915. answeringTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  916. answeringTitle.setBounds(320, 25, 700, 120);
  917.  
  918. JLabel answeringDescription = new JLabel("<html> Answering a question varies by it's type."
  919. + " For the multiple choice questions, your answer will be taken in once you click on one of the options."
  920. + " For the fill in the blank questions will give you a box to type in your answer."
  921. + " Remember, this quiz case sensitive."
  922. + " Make sure to use captials only on pronouns and correct casing (beggining of a sentence).");
  923. answeringDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  924. answeringDescription.setBounds(150, 50, 700, 500);
  925.  
  926. JButton answeringBack = new JButton("Return");
  927. answeringBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  928. answeringBack.setBounds(350, 600, 300, 100);
  929.  
  930. answeringTutorial.add(answeringTitle);
  931. answeringTutorial.add(answeringDescription);
  932. answeringTutorial.add(answeringBack);
  933.  
  934. card2.show(mainTutorial, "five");
  935.  
  936. answeringBack.addActionListener(new ActionListener(){
  937.  
  938. public void actionPerformed(ActionEvent e){
  939.  
  940. tutorial();
  941.  
  942. }
  943. });
  944.  
  945. }
  946. //END: methods used by the tutorial screen exclusively
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement