Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static String[] Q = new String[30];{
- Q[0] = "Which of the following is a requirement in order to vote in a Canadian federal election?";
- Q[1] = "What major sporting event was held in Canada in 2010?";
- Q[2] = "Which of the following is not a province of Canada?";
- Q[3] = "Who was the first Prime Minister of Canada? ";
- Q[4] = "How many Oceans border Canada? ";
- Q[5] = "What is the status of Canada? ";
- Q[6] = "Which of the following islands is not part of Canada? ";
- Q[7] = "Which is the longest river in Canada? ";
- Q[8] = "Which Canadian province is the country’s largest producer and exporter of maple syrup? ";
- Q[9] = "Who donated the Stanley Cup to the National Hockey League? ";
- Q[10] = "Why did Ottawa establish the Mounted Police in 1873? ";
- Q[11] = "Which famous Canadian composed the Canadian national anthem? ";
- Q[12] = "Who is the Head of State of Canada? ";
- Q[13] = "Who after winning gold medal in 100 metres race in Seoul Olympics 1988 tested positive for drugs and was thrown out? ";
- Q[14] = "What university developed the world’s first anti-gravity suit? ";
- Q[15] = "O Canada! Our home and ______ land!";
- Q[16] = "Red and _____ are the national colours of Canada.";
- Q[17] = "The national animal of Canada is the ______ .";
- Q[18] = "Lacrosse is Canada’s national summer sport, _____ is the national winter sport.";
- Q[19] = "English and ______ are Canada’s national languages.";
- Q[20] = "The _____ leaf is featured on Canada’s national flag.";
- Q[21] = "Royal Canadian _______ Police are the federal police force of Canada.";
- Q[22] = "Canada’s newest territory is _______ .";
- Q[23] = "Canada celebrates its independence on ____ 1st every year.";
- Q[24] = "On one side of a quarter in The Queen, on the other side is a _____ .";
- Q[25] = "Wilfrid _______ is the man on the $5 bill.";
- Q[26] = "The name Canada originally meant _______ or settlement.";
- Q[27] = "The $2 coin of Canada is called a Toonie, the $1 coin is called a ______ .";
- Q[28] = "Mount _____ is the highest mountain in Canada.";
- Q[29] = "In Canada you may not publicly remove a ________ . ";}
- static String[] optionA = new String[15];{
- optionA[0]= " a) Your are at least 18 years old on election day";
- optionA[1]= " a) Summer Olympics ";
- optionA[2]= " a) Alberta ";
- optionA[3]= " a) Alexander Mackenzie ";
- optionA[4]= " a) 1";
- optionA[5]= " a) Republic";
- optionA[6]= " a) Greenland";
- optionA[7]= " a) St. Lawrence";
- optionA[8]= " a) Ontario";
- optionA[9]= " a) Bill Stanley";
- optionA[10]=" a) To perform equestrian shows";
- optionA[11]=" a) Ceiline Dion";
- optionA[12]=" a) President";
- optionA[13]=" a) Donovan Bailey";
- optionA[14]=" a) University of Toronto";}
- static String[] optionB = new String [15];{
- optionB[0]= " b) You are a Canadian citizen" ;
- optionB[1]= " b) Winter Olympics";
- optionB[2]= " b) British Columbia";
- optionB[3]= " b) John A. MacDonald";
- optionB[4]= " b) 2";
- optionB[5]= " b) Dominion";
- optionB[6]= " b) Baffin Island";
- optionB[7]= " b) Mackenzie";
- optionB[8]= " b) British Columbia";
- optionB[9]= " b) Governor General Lord Stanley";
- optionB[10]= " b) To pacify the West and negotiate with the Indians";
- optionB[11]= " b) Calixa Lavallee";
- optionB[12]= " b) Governor General";
- optionB[13]= " b) Ben Johnson";
- optionB[14]= " b) Simon Fraser University"; }
- static String[] optionC = new String [15];{
- optionC[0]= " c) You can prove your identity and address";
- optionC[1]= " c) World Cup ";
- optionC[2]= " c) Rhode Island ";
- optionC[3]= " c) Louis Riel ";
- optionC[4]= " c) 3 ";
- optionC[5]= " c) Kingdom ";
- optionC[6]= " c) Victoria Island ";
- optionC[7]= " c) Nelson ";
- optionC[8]= " c) Quebec ";
- optionC[9]= " c) Stanley Lord ";
- optionC[10]= " c) To arrest Louis Riel ";
- optionC[11]= " c) Bryan Adams ";
- optionC[12]= " c) Monarch of United Kingdom ";
- optionC[13]= " c) Carl Lewis ";
- optionC[14]= " c) University of British Columbia "; }
- static String[] optionD = new String [15];{
- optionD[0]= " d) All of the above";
- optionD[1]= " d) Commonwealth Games ";
- optionD[2]= " d) Quebec ";
- optionD[3]= " d) Wilfred Laurier ";
- optionD[4]= " d) 4 ";
- optionD[5]= " d) Commonwealth ";
- optionD[6]= " d) Prince Edward Island ";
- optionD[7]= " d) Fraser ";
- optionD[8]= " d) New Brunswick ";
- optionD[9]= " d) Stanley Bill ";
- optionD[10]= " d) To drive the Metis out of Canada ";
- optionD[11]= " d) Gordon Lightfoot ";
- optionD[12]= " d) Prime Minister ";
- optionD[13]= " d) Roger Bannister ";
- optionD[14]= " d) Queen’s University "; }
- static String[] answer = new String [30];{
- answer[0]= "D";
- answer[1]= "B";
- answer[2]= "C";
- answer[3]= "B";
- answer[4]= "C";
- answer[5]= "B";
- answer[6]= "A";
- answer[7]= "B";
- answer[8]= "C";
- answer[9]= "B";
- answer[10]= "B";
- answer[11]= "B";
- answer[12]= "C";
- answer[13]= "C";
- answer[14]= "A";
- answer[15]= "native";
- answer[16]= "white" ;
- answer[17]= "beaver" ;
- answer[18]= "hockey";
- answer[19]= "French";
- answer[20]= "maple";
- answer[21]= "Mounted";
- answer[22]= "Nunavut";
- answer[23]= "July";
- answer[24]= "moose";
- answer[25]= "Laurier";
- answer[26]= "village";
- answer[27]= "Loonie";
- answer[28]= "Logan";
- answer[29]= "Band-Aid";}
- //first screen to be seen, asks user if they would like to open tutorial window
- public static void introScreen(){ //Main Programmer: Amarnath Parthiban
- JPanel introScreen = new JPanel();
- introScreen.setLayout(null);
- final JFrame introFrame = new JFrame("Welcome");
- introFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- introFrame.add(introScreen);
- //text to be displayed on screen
- JLabel introTitle = new JLabel("So you think you're Canadian, eh?");
- introTitle.setFont(new Font("Calibri", Font.PLAIN, 20));
- introTitle.setBounds(5, 0, 500, 25);
- JLabel introText1 = new JLabel("Welcome to the CIA Canadian trivia quiz.");
- introText1.setFont(new Font("Calibri", Font.PLAIN, 16));
- introText1.setBounds(15, 25, 500, 25);
- JLabel introText2 = new JLabel("Would you like to take the tutorial?");
- introText2.setFont(new Font("Calibri", Font.PLAIN, 16));
- introText2.setBounds(25, 50, 500, 25);
- //buttons for user input
- JButton yesTutorial = new JButton("YES");
- yesTutorial.setFont(new Font("Calibri", Font.PLAIN, 16));
- yesTutorial.setBounds(55, 75, 70, 30);
- JButton noTutorial = new JButton("NO");
- noTutorial.setFont(new Font("Calibri", Font.PLAIN, 16));
- noTutorial.setBounds(165, 75, 70, 30);
- introScreen.add(introTitle);
- introScreen.add(introText1);
- introScreen.add(introText2);
- introScreen.add(yesTutorial);
- introScreen.add(noTutorial);
- introFrame.setSize(310,160);
- introFrame.setVisible(true);
- yesTutorial.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- //removes first window and opens the tutorial window
- introFrame.dispose();
- tutorial();
- }
- });
- noTutorial.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- //removes first window and opens main quiz window
- introFrame.dispose();
- quiz();
- }
- });
- }
- //static panel and frame to allow only one instance of the window to be open
- static JPanel mainQuiz = new JPanel();
- static JFrame mainFrame = new JFrame("CAI Quiz");
- static CardLayout card1 = new CardLayout();
- //used to determine if the main quiz screen is open, defaulted to false for safety
- static boolean quizState = false;
- public static void quiz(){ //Main Programmer: Amarnath Parthiban
- mainQuiz.setLayout(card1);
- mainFrame.add(mainQuiz);
- JPanel quiz = new JPanel();
- //allows use of (x,y) positions on JPanel
- quiz.setLayout(null);
- //changes the state to inform that main quiz is open and other windows can be closed without ending the program
- quizState = true;
- mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- mainQuiz.add(quiz, "a");
- //title
- JLabel mainTitle = new JLabel("CAI CANADIAN QUIZ");
- mainTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
- mainTitle.setBounds(190, 25, 700, 60);
- //buttons for each question type and level including a random and tutorial button
- JButton MCLevel1 = new JButton("Multiple Choice Level 1");
- MCLevel1.setFont(new Font("Calibri", Font.PLAIN, 25));
- MCLevel1.setBounds(150, 200, 300, 100);
- JButton MCLevel2 = new JButton("Multiple Choice Level 2");
- MCLevel2.setFont(new Font("Calibri", Font.PLAIN, 25));
- MCLevel2.setBounds(150, 350, 300, 100);
- JButton MCLevel3 = new JButton("Multiple Choice Level 3");
- MCLevel3.setFont(new Font("Calibri", Font.PLAIN, 25));
- MCLevel3.setBounds(150, 500, 300, 100);
- JButton FIBLevel1 = new JButton("Fill in The Blank Level 1");
- FIBLevel1.setFont(new Font("Calibri", Font.PLAIN, 25));
- FIBLevel1.setBounds(550, 200, 300, 100);
- JButton FIBLevel2 = new JButton("Fill in The Blank Level 2");
- FIBLevel2.setFont(new Font("Calibri", Font.PLAIN, 25));
- FIBLevel2.setBounds(550, 350, 300, 100);
- JButton FIBLevel3 = new JButton("Fill in The Blank Level 3");
- FIBLevel3.setFont(new Font("Calibri", Font.PLAIN, 25));
- FIBLevel3.setBounds(550, 500, 300, 100);
- JButton random = new JButton("Random");
- random.setFont(new Font("Calibri", Font.PLAIN, 25));
- random.setBounds(350, 650, 300, 100);
- JButton tutorial = new JButton("Tutorial");
- tutorial.setFont(new Font("Calibri", Font.PLAIN, 20));
- tutorial.setBounds(10, 650, 100, 100);
- quiz.add(mainTitle);
- quiz.add(MCLevel1);
- quiz.add(MCLevel2);
- quiz.add(MCLevel3);
- quiz.add(FIBLevel1);
- quiz.add(FIBLevel2);
- quiz.add(FIBLevel3);
- quiz.add(random);
- quiz.add(tutorial);
- mainFrame.setSize(1000,800);
- mainFrame.setVisible(true);
- card1.show(mainQuiz, "a");
- MCLevel1.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- MCLevel1();
- }
- });
- MCLevel2.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- MCLevel2();
- }
- });
- MCLevel3.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- MCLevel3();
- }
- });
- FIBLevel1.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- FIBLevel1();
- }
- });
- FIBLevel2.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- FIBLevel2();
- }
- });
- FIBLevel3.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- FIBLevel3();
- }
- });
- tutorial.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- //allows user to open tutorial when needed
- tutorial();
- }
- });
- }
- static int x;
- static boolean state;
- static JLabel sessionScore = new JLabel("Session Score: N/A");
- static int questionsPerSession = 0;
- static int sessionCorrect = 0;
- public static void MCLevel1(){ //Main Programmer: Amarnath Parthiban
- questionsPerSession = 0;
- final JPanel MC1 = new JPanel();
- MC1.setLayout(null);
- mainQuiz.add(MC1, "b");
- JLabel MC1Title = new JLabel("Multiple Choice Level 1");
- MC1Title.setFont(new Font("Calibri", Font.PLAIN, 50));
- MC1Title.setBounds(10, -30, 700, 120);
- sessionScore.setFont(new Font("Calibri", Font.PLAIN, 25));
- sessionScore.setBounds(710, 650, 300, 120);
- JButton MC1Back = new JButton("Return");
- MC1Back.setFont(new Font("Calibri", Font.PLAIN, 32));
- MC1Back.setBounds(5, 650, 300, 100);
- JLabel question = new JLabel();
- JRadioButton A = new JRadioButton();
- JRadioButton B = new JRadioButton();
- JRadioButton C = new JRadioButton();
- JRadioButton D = new JRadioButton();
- for (x = 0; x <= 5; x++){
- MC1.repaint();
- question.setText(Q[x]);
- question.setFont(new Font("Calibri", Font.PLAIN, 15));
- question.setBounds(110, 150, 270, 70);
- A.setText(optionA[x]);
- A.setBounds(115, 240, 100, 10);
- A.setActionCommand("A");
- B.setText(optionB[x]);
- B.setBounds(115, 255, 100, 10);
- B.setActionCommand("B");
- C.setText(optionC[x]);
- C.setBounds(115, 270, 100, 10);
- C.setActionCommand("C");
- D.setText(optionD[x]);
- D.setBounds(115, 285, 100, 10);
- D.setActionCommand("D");
- ButtonGroup Q1Group = new ButtonGroup();
- Q1Group.add(A);
- Q1Group.add(B);
- Q1Group.add(C);
- Q1Group.add(D);
- JButton submit = new JButton("Submit");
- submit.setFont(new Font("Calibri", Font.PLAIN, 32));
- submit.setBounds(205, 450, 300, 100);
- MC1.add(MC1Title);
- MC1.add(question);
- MC1.add(MC1Back);
- MC1.add(A);
- MC1.add(B);
- MC1.add(C);
- MC1.add(D);
- MC1.add(sessionScore);
- MC1.add(submit);
- card1.show(mainQuiz, "b");
- MC1Back.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- quiz();
- }
- });
- A.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- state = result("A");
- }
- });
- B.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- state = result("B");
- }
- });
- C.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- state = result("C");
- }
- });
- D.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- state = result("D");
- }
- });
- questionsPerSession++;
- score();
- }
- }
- public static boolean result(String userAnswer){
- if (userAnswer.equals(answer[x])){
- sessionCorrect++;
- return true;
- }
- else
- return false;
- }
- public static void sessionScoreCalculate(){
- sessionScore.setText("Session Score: " + (sessionCorrect/questionsPerSession) );
- }
- public static void MCLevel2(){ //Main Programmer: Amarnath Parthiban
- JPanel MC2 = new JPanel();
- MC2.setLayout(null);
- mainQuiz.add(MC2, "c");
- JLabel MC1Title = new JLabel("Score");
- MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
- MC1Title.setBounds(380, 25, 700, 120);
- 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."
- + " On the main menu your score will be displayed once as your overall score."
- + " When in a session your total score as well as your session score will be visible."
- + " These scores will automaticly updated as you continue on with your session."
- + " 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>");
- scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
- scoreDescription.setBounds(150, 50, 700, 500);
- JButton scoreBack = new JButton("Return");
- scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
- scoreBack.setBounds(350, 600, 300, 100);
- MC2.add(MC1Title);
- MC2.add(scoreDescription);
- MC2.add(scoreBack);
- card1.show(mainQuiz, "c");
- scoreBack.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- quiz();
- }
- });
- }
- public static void MCLevel3(){ //Main Programmer: Amarnath Parthiban
- JPanel MC3 = new JPanel();
- MC3.setLayout(null);
- mainQuiz.add(MC3, "d");
- JLabel MC1Title = new JLabel("Score");
- MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
- MC1Title.setBounds(380, 25, 700, 120);
- 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."
- + " On the main menu your score will be displayed once as your overall score."
- + " When in a session your total score as well as your session score will be visible."
- + " These scores will automaticly updated as you continue on with your session."
- + " 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>");
- scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
- scoreDescription.setBounds(150, 50, 700, 500);
- JButton scoreBack = new JButton("Return");
- scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
- scoreBack.setBounds(350, 600, 300, 100);
- MC3.add(MC1Title);
- MC3.add(scoreDescription);
- MC3.add(scoreBack);
- card1.show(mainQuiz, "d");
- scoreBack.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- quiz();
- }
- });
- }
- public static void FIBLevel1(){ //Main Programmer: Amarnath Parthiban
- JPanel FIB1 = new JPanel();
- FIB1.setLayout(null);
- mainQuiz.add(FIB1, "e");
- JLabel MC1Title = new JLabel("Score");
- MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
- MC1Title.setBounds(380, 25, 700, 120);
- 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."
- + " On the main menu your score will be displayed once as your overall score."
- + " When in a session your total score as well as your session score will be visible."
- + " These scores will automaticly updated as you continue on with your session."
- + " 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>");
- scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
- scoreDescription.setBounds(150, 50, 700, 500);
- JButton scoreBack = new JButton("Return");
- scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
- scoreBack.setBounds(350, 600, 300, 100);
- FIB1.add(MC1Title);
- FIB1.add(scoreDescription);
- FIB1.add(scoreBack);
- card1.show(mainQuiz, "e");
- scoreBack.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- quiz();
- }
- });
- }
- public static void FIBLevel2(){ //Main Programmer: Amarnath Parthiban
- JPanel FIB2 = new JPanel();
- FIB2.setLayout(null);
- mainQuiz.add(FIB2, "f");
- JLabel MC1Title = new JLabel("Score");
- MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
- MC1Title.setBounds(380, 25, 700, 120);
- 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."
- + " On the main menu your score will be displayed once as your overall score."
- + " When in a session your total score as well as your session score will be visible."
- + " These scores will automaticly updated as you continue on with your session."
- + " 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>");
- scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
- scoreDescription.setBounds(150, 50, 700, 500);
- JButton scoreBack = new JButton("Return");
- scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
- scoreBack.setBounds(350, 600, 300, 100);
- FIB2.add(MC1Title);
- FIB2.add(scoreDescription);
- FIB2.add(scoreBack);
- card1.show(mainQuiz, "f");
- scoreBack.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- quiz();
- }
- });
- }
- public static void FIBLevel3(){ //Main Programmer: Amarnath Parthiban
- JPanel FIB3 = new JPanel();
- FIB3.setLayout(null);
- mainQuiz.add(FIB3, "g");
- JLabel MC1Title = new JLabel("Score");
- MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
- MC1Title.setBounds(380, 25, 700, 120);
- 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."
- + " On the main menu your score will be displayed once as your overall score."
- + " When in a session your total score as well as your session score will be visible."
- + " These scores will automaticly updated as you continue on with your session."
- + " 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>");
- scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
- scoreDescription.setBounds(150, 50, 700, 500);
- JButton scoreBack = new JButton("Return");
- scoreBack.setFont(new Font("Calibri", Font.PLAIN, 75));
- scoreBack.setBounds(350, 600, 300, 100);
- FIB3.add(MC1Title);
- FIB3.add(scoreDescription);
- FIB3.add(scoreBack);
- card1.show(mainQuiz, "g");
- scoreBack.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- quiz();
- }
- });
- }
- //static panel and frame to allow only one instance of the window to be open
- static JPanel mainTutorial = new JPanel();
- static JFrame tutorialFrame = new JFrame("Tutorial");
- //allows for multiple JPanels on one JFrame
- static CardLayout card2 = new CardLayout();
- public static void tutorial(){ //Main Programmer: Amarnath Parthiban
- mainTutorial.setLayout(card2);
- tutorialFrame.add(mainTutorial);
- //additional panel to set on top and interchange between other panels
- JPanel tutorial = new JPanel();
- tutorial.setLayout(null);
- mainTutorial.add(tutorial, "one");
- //determine if the tutorial window needs to stop the program or not
- if (quizState == true)
- tutorialFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- else
- tutorialFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- //title for the panel
- JLabel tutorialTitle = new JLabel("Tutorial");
- tutorialTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
- tutorialTitle.setBounds(380, 25, 700, 60);
- //buttons for each topic, including a quiz button
- JButton score = new JButton("Score");
- score.setFont(new Font("Calibri", Font.PLAIN, 32));
- score.setBounds(150, 200, 300, 100);
- JButton level = new JButton("Level");
- level.setFont(new Font("Calibri", Font.PLAIN, 32));
- level.setBounds(150, 400, 300, 100);
- JButton type = new JButton("Type");
- type.setFont(new Font("Calibri", Font.PLAIN, 32));
- type.setBounds(550, 200, 300, 100);
- JButton answering = new JButton("Answering");
- answering.setFont(new Font("Calibri", Font.PLAIN, 32));
- answering.setBounds(550, 400, 300, 100);
- JButton main = new JButton("QUIZ SCREEN");
- main.setFont(new Font("Calibri", Font.PLAIN, 32));
- main.setBounds(350, 600, 300, 100);
- tutorial.add(tutorialTitle);
- tutorial.add(score);
- tutorial.add(level);
- tutorial.add(type);
- tutorial.add(answering);
- tutorial.add(main);
- tutorialFrame.setSize(1000,800);
- tutorialFrame.setVisible(true);
- //displays the home tutorial panel
- card2.show(mainTutorial, "one");
- //calling methods for each of the topics depending on button pushed
- score.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- score();
- }
- });
- level.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- level();
- }
- });
- type.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- type();
- }
- });
- answering.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- answering();
- }
- });
- main.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- //open the quiz window, make the tutoral window disposible without ending the program
- tutorialFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- quiz();
- }
- });
- }
- //START: methods used by the tutorial screen exclusively
- //each method contains a title, a brief description and a button to return to the main tutorial screen
- public static void score(){ //Main Programmer: Amarnath Parthiban
- JPanel scoreTutorial = new JPanel();
- scoreTutorial.setLayout(null);
- mainTutorial.add(scoreTutorial, "two");
- JLabel scoreTitle = new JLabel("Score");
- scoreTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
- scoreTitle.setBounds(380, 25, 700, 120);
- 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."
- + " On the main menu your score will be displayed once as your overall score."
- + " When in a session your total score as well as your session score will be visible."
- + " These scores will automaticly updated as you continue on with your session."
- + " 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>");
- scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
- scoreDescription.setBounds(150, 50, 700, 500);
- JButton scoreBack = new JButton("Return");
- scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
- scoreBack.setBounds(350, 600, 300, 100);
- scoreTutorial.add(scoreTitle);
- scoreTutorial.add(scoreDescription);
- scoreTutorial.add(scoreBack);
- card2.show(mainTutorial, "two");
- scoreBack.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- tutorial();
- }
- });
- }
- public static void level(){ //Main Programmer: Amarnath Parthiban
- JPanel levelTutorial = new JPanel();
- levelTutorial.setLayout(null);
- mainTutorial.add(levelTutorial, "three");
- JLabel levelTitle = new JLabel("Level");
- levelTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
- levelTitle.setBounds(380, 25, 700, 120);
- JLabel levelDescription = new JLabel("<html> Every type has 3 levels; easy, medium and hard."
- + " The easy questions are basic questions, the answers to these questions should come from the top of you head."
- + " Medium-leveled questions modertaley difficult. They require some background knowledge of Canada."
- + " In each level, there will be five questions."
- + " After answering a new one , under the same level will appear. "
- + " The hard questions have a high difficulty rating. You will need to know every inch of Canadian history, geography and culture."
- + " Don't worry about the level. I think you can do it. </html>");
- levelDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
- levelDescription.setBounds(150, 50, 700, 500);
- JButton levelBack = new JButton("Return");
- levelBack.setFont(new Font("Calibri", Font.PLAIN, 32));
- levelBack.setBounds(350, 600, 300, 100);
- levelTutorial.add(levelTitle);
- levelTutorial.add(levelDescription);
- levelTutorial.add(levelBack);
- card2.show(mainTutorial, "three");
- levelBack.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- tutorial();
- }
- });
- }
- public static void type(){ //Main Programmer: Amarnath Parthiban
- JPanel typeTutorial = new JPanel();
- typeTutorial.setLayout(null);
- mainTutorial.add(typeTutorial, "four");
- JLabel typeTitle = new JLabel("Type");
- typeTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
- typeTitle.setBounds(380, 25, 700, 120);
- JLabel typeDescription = new JLabel("<html>In this quiz, there are three types of questions; multiple choice, fill in the blanks and random."
- + " If you choose a multiple choice question the options will be given to you along with the question ."
- + " The fill in the blanks will require you to type in the missing word of the phrase."
- + " Random is a type where the computer chooses a question type for you and."
- + " 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>");
- typeDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
- typeDescription.setBounds(150, 50, 700, 500);
- JButton typeBack = new JButton("Return");
- typeBack.setFont(new Font("Calibri", Font.PLAIN, 32));
- typeBack.setBounds(350, 600, 300, 100);
- typeTutorial.add(typeTitle);
- typeTutorial.add(typeDescription);
- typeTutorial.add(typeBack);
- card2.show(mainTutorial, "four");
- typeBack.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- tutorial();
- }
- });
- }
- public static void answering(){ //Main Programmer: Amarnath Parthiban
- JPanel answeringTutorial = new JPanel();
- answeringTutorial.setLayout(null);
- mainTutorial.add(answeringTutorial, "five");
- JLabel answeringTitle = new JLabel("Answering");
- answeringTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
- answeringTitle.setBounds(320, 25, 700, 120);
- JLabel answeringDescription = new JLabel("<html> Answering a question varies by it's type."
- + " For the multiple choice questions, your answer will be taken in once you click on one of the options."
- + " For the fill in the blank questions will give you a box to type in your answer."
- + " Remember, this quiz case sensitive."
- + " Make sure to use captials only on pronouns and correct casing (beggining of a sentence).");
- answeringDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
- answeringDescription.setBounds(150, 50, 700, 500);
- JButton answeringBack = new JButton("Return");
- answeringBack.setFont(new Font("Calibri", Font.PLAIN, 32));
- answeringBack.setBounds(350, 600, 300, 100);
- answeringTutorial.add(answeringTitle);
- answeringTutorial.add(answeringDescription);
- answeringTutorial.add(answeringBack);
- card2.show(mainTutorial, "five");
- answeringBack.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- tutorial();
- }
- });
- }
- //END: methods used by the tutorial screen exclusively
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement