Advertisement
Guest User

Untitled

a guest
Jan 20th, 2016
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 11.40 KB | None | 0 0
  1. // The "Summative" class.
  2. import java.awt.*;
  3. import hsa.Console;
  4.  
  5. public class Summative
  6. {
  7.     static Console c;           // The output console
  8.    
  9.     public static void main (String[] args )throws InterruptedException
  10.     {
  11.         c = new Console ();
  12.  
  13.         //Test Score Counter
  14.         double quizScore = 0;
  15.        
  16.         //Title Page
  17.         c.println("  _____       _                       _     _____      _                       ");
  18.         c.println(" |_   _|     | |                     | |   |  __ \\    (_)                      ");
  19.         c.println("   | |  _ __ | |_ ___ _ __ _ __   ___| |_  | |__) | __ ___   ____ _  ___ _   _ ");
  20.         c.println("   | | | '_ \\| __/ _ \\ '__| '_ \\ / _ \\ __| |  ___/ '__| \\ \\ / / _` |/ __| | | |");
  21.         c.println("  _| |_| | | | ||  __/ |  | | | |  __/ |_  | |   | |  | |\\ V / (_| | (__| |_| |");
  22.         c.println(" |_____|_| |_|\\__\\___|_|  |_| |_|\\___|\\__| |_|   |_|  |_| \\_/ \\__,_|\\___|\\__, |");
  23.         c.println("                                                                          __/ |");
  24.         c.println("                                                                         |___/ ");
  25.         c.println("                                ____        _     ");
  26.         c.println("                               / __ \\      (_)    ");
  27.         c.println("                              | |  | |_   _ _ ____");
  28.         c.println("                              | |  | | | | | |_  /");
  29.         c.println("                              | |__| | |_| | |/ / ");
  30.         c.println("                               \\___\\_\\\\__,_|_/___|");
  31.         c.println("");
  32.         c.println("");
  33.         c.println("");
  34.         c.println("");
  35.         c.println("");
  36.         c.println("");
  37.         c.println("");
  38.         c.println("");
  39.         c.println("");
  40.         c.setTextColor(Color.red);
  41.         c.println("Please press any key to continue...");
  42.         c.setTextColor(Color.black);
  43.         c.getChar();
  44.         c.clear();
  45.        
  46.         do
  47.         {
  48.         //Lock
  49.         c.setColor(new Color(255, 204, 153));
  50.         c.drawRect(490,350,100,100);
  51.         c.fillRect(490,350,100,100);
  52.         c.setColor(Color.black);
  53.         c.fillOval(521,370,40,40);
  54.         c.fillRect(531,380,20,50);
  55.         c.setColor(new Color(191, 191, 191));
  56.         c.fillRect(500,310,20,40);
  57.         c.fillRect(562,310,20,40);
  58.         c.fillRect(500,300,82,15);
  59.         c.setColor(Color.black);
  60.        
  61.         //Disclaimer
  62.         c.println("NOTE: YOU ARE NOT TOLD WHETHER YOUR ANSWER IS RIGHT OR WRONG RIGHT AWAY");
  63.         c.println("YOUR SCORE IS PRESENTED AT THE END OF THE QUIZ");
  64.         c.println("");
  65.         c.println("");
  66.         c.println("");
  67.         c.println("");
  68.         c.setTextColor(Color.red);
  69.         c.print("Please press any key to continue...");
  70.         c.setTextColor(Color.black);
  71.         c.getChar();
  72.         c.clear();
  73.        
  74.         //Lock
  75.         c.setColor(new Color(255, 204, 153));
  76.         c.drawRect(490,350,100,100);
  77.         c.fillRect(490,350,100,100);
  78.         c.setColor(Color.black);
  79.         c.fillOval(521,370,40,40);
  80.         c.fillRect(531,380,20,50);
  81.         c.setColor(new Color(191, 191, 191));
  82.         c.fillRect(500,310,20,40);
  83.         c.fillRect(562,310,20,40);
  84.         c.fillRect(500,300,82,15);
  85.         c.setColor(Color.black);
  86.        
  87.         //First Question
  88.          c.println("In what year did Edward Snowden leak the NSA files to the public?");
  89.          c.println("A-2005");
  90.          c.println("B-2014");
  91.          c.println("C-2013");
  92.          String userAnswer = c.readLine();
  93.          if (userAnswer.equalsIgnoreCase("C"))
  94.         {
  95.          c.setTextColor(Color.red);
  96.          c.println("Thank you, please move onto the next question");
  97.          c.setTextColor(Color.black);
  98.          quizScore = quizScore + 1;
  99.          c.setTextColor(Color.red);
  100.          c.println("Please press any key to continue...");
  101.          c.setTextColor(Color.black);
  102.          c.getChar();
  103.          c.clear();
  104.          }
  105.          else
  106.          {
  107.           c.setTextColor(Color.red);
  108.           c.println("Thank you, please move onto the next question");
  109.           c.setTextColor(Color.black);
  110.           c.setTextColor(Color.red);
  111.           c.println("Please press any key to continue...");
  112.           c.setTextColor(Color.black);
  113.           c.getChar();
  114.           c.clear();
  115.          }
  116.        
  117.          //Lock
  118.         c.setColor(new Color(255, 204, 153));
  119.         c.drawRect(490,350,100,100);
  120.         c.fillRect(490,350,100,100);
  121.         c.setColor(Color.black);
  122.         c.fillOval(521,370,40,40);
  123.         c.fillRect(531,380,20,50);
  124.         c.setColor(new Color(191, 191, 191));
  125.         c.fillRect(500,310,20,40);
  126.         c.fillRect(562,310,20,40);
  127.         c.fillRect(500,300,82,15);
  128.         c.setColor(Color.black);
  129.          
  130.          //Second Question
  131.          c.println("Which one of these things does the facebook app need permission for?");
  132.          c.println("A-Device ID & Call Information");
  133.          c.println("B-Location");
  134.          c.println("C-Device & App History");
  135.          c.println("D-All of the above");
  136.          String userAnswerTwo = c.readLine();
  137.          if (userAnswerTwo.equalsIgnoreCase("D"))
  138.          {
  139.           c.setTextColor(Color.red);
  140.           c.println("Thank you, please move onto the next question");
  141.           c.setTextColor(Color.black);
  142.           quizScore = quizScore + 1;
  143.           c.println("Please press any key to continue...");
  144.           c.setTextColor(Color.black);
  145.           c.getChar();
  146.           c.clear();
  147.          }
  148.          else
  149.          {
  150.           c.setTextColor(Color.red);
  151.           c.println("Thank you, please move onto the next question");
  152.           c.setTextColor(Color.black);
  153.           c.println("Please press any key to continue...");
  154.           c.setTextColor(Color.black);
  155.           c.getChar();
  156.           c.clear();
  157.          }
  158.        
  159.          //Lock
  160.         c.setColor(new Color(255, 204, 153));
  161.         c.drawRect(490,350,100,100);
  162.         c.fillRect(490,350,100,100);
  163.         c.setColor(Color.black);
  164.         c.fillOval(521,370,40,40);
  165.         c.fillRect(531,380,20,50);
  166.         c.setColor(new Color(191, 191, 191));
  167.         c.fillRect(500,310,20,40);
  168.         c.fillRect(562,310,20,40);
  169.         c.fillRect(500,300,82,15);
  170.         c.setColor(Color.black);
  171.          
  172.         //Third Question
  173.          c.println("What was Ryan Kazaryan charged for?");
  174.          c.println("A-Taking pictures of people naked, and blackmailing");
  175.          c.println("B-Selling people's personal information");
  176.          c.println("C-Leaking top-secret NSA files");
  177.          String userAnswerThree = c.readLine();
  178.          if (userAnswerThree.equalsIgnoreCase("A"))
  179.          {
  180.           c.setTextColor(Color.red);
  181.           c.println("Thank you, please move onto the next question");
  182.           c.setTextColor(Color.black);
  183.           quizScore = quizScore + 1;
  184.           c.println("Please press any key to continue...");
  185.           c.setTextColor(Color.black);
  186.           c.getChar();
  187.           c.clear();
  188.          }
  189.          else
  190.          {
  191.           c.setTextColor(Color.red);
  192.           c.println("Thank you, please move onto the next question");
  193.           c.setTextColor(Color.black);
  194.           c.println("Please press any key to continue...");
  195.           c.setTextColor(Color.black);
  196.           c.getChar();
  197.           c.clear();
  198.          }
  199.        
  200.          //Lock
  201.         c.setColor(new Color(255, 204, 153));
  202.         c.drawRect(490,350,100,100);
  203.         c.fillRect(490,350,100,100);
  204.         c.setColor(Color.black);
  205.         c.fillOval(521,370,40,40);
  206.         c.fillRect(531,380,20,50);
  207.         c.setColor(new Color(191, 191, 191));
  208.         c.fillRect(500,310,20,40);
  209.         c.fillRect(562,310,20,40);
  210.         c.fillRect(500,300,82,15);
  211.         c.setColor(Color.black);
  212.          
  213.         //Fourth Question
  214.          c.println("What ISP is the worst at following Canadian privacy guidelines?");
  215.          c.println("A-Shaw");
  216.          c.println("B-Storm Internet");
  217.          c.println("C-Acanac");
  218.          String userAnswerFour = c.readLine();
  219.          if (userAnswerFour.equalsIgnoreCase("C"))
  220.          {
  221.           c.setTextColor(Color.red);
  222.           c.println("Thank you, please move onto the next question");
  223.           c.setTextColor(Color.black);
  224.           quizScore = quizScore + 1;
  225.           c.println("Please press any key to continue...");
  226.           c.setTextColor(Color.black);
  227.           c.getChar();
  228.           c.clear();
  229.          }
  230.          else
  231.          {
  232.           c.setTextColor(Color.red);
  233.           c.println("Thank you, please move onto the next question");
  234.           c.setTextColor(Color.black);
  235.           c.println("Please press any key to continue...");
  236.           c.setTextColor(Color.black);
  237.           c.getChar();
  238.           c.clear();
  239.          }
  240.        
  241.          //Lock
  242.         c.setColor(new Color(255, 204, 153));
  243.         c.drawRect(490,350,100,100);
  244.         c.fillRect(490,350,100,100);
  245.         c.setColor(Color.black);
  246.         c.fillOval(521,370,40,40);
  247.         c.fillRect(531,380,20,50);
  248.         c.setColor(new Color(191, 191, 191));
  249.         c.fillRect(500,310,20,40);
  250.         c.fillRect(562,310,20,40);
  251.         c.fillRect(500,300,82,15);
  252.         c.setColor(Color.black);
  253.          
  254.         //Fifth Question
  255.          c.println("What's the most fool proof way to ensure your privacy is safe on the internet?");
  256.          c.println("A-Avoid all social media websites");
  257.          c.println("B-Don't use the internet at all");
  258.          c.println("C-Upload your information only on sites you trust");
  259.          String userAnswerFive = c.readLine();
  260.          if (userAnswerFive.equalsIgnoreCase("B"))
  261.          {
  262.           c.setTextColor(Color.red);
  263.           c.println("Thank you, please move onto the next question");
  264.           c.setTextColor(Color.black);
  265.           quizScore = quizScore + 1;
  266.           c.println("Please press any key to continue...");
  267.           c.setTextColor(Color.black);
  268.           c.getChar();
  269.           c.clear();
  270.          }
  271.          else
  272.          {
  273.           c.setTextColor(Color.red);
  274.           c.println("Thank you, please move onto the next question");
  275.           c.setTextColor(Color.black);
  276.           c.println("Please press any key to continue...");
  277.           c.setTextColor(Color.black);
  278.           c.getChar();
  279.           c.clear();
  280.          }
  281.          
  282.          //Lock
  283.         c.setColor(new Color(255, 204, 153));
  284.         c.drawRect(490,350,100,100);
  285.         c.fillRect(490,350,100,100);
  286.         c.setColor(Color.black);
  287.         c.fillOval(521,370,40,40);
  288.         c.fillRect(531,380,20,50);
  289.         c.setColor(new Color(191, 191, 191));
  290.         c.fillRect(500,310,20,40);
  291.         c.fillRect(562,310,20,40);
  292.         c.fillRect(500,300,82,15);
  293.         c.setColor(Color.black);
  294.          
  295.         //End of the quiz
  296.          double percentage = quizScore/5;
  297.          percentage = percentage * 100;
  298.          c.println("Thank you for completing this quiz!");
  299.          c.println("Your score was " + quizScore + " out of 5");
  300.          c.println("Which was " + percentage + "%");
  301.          if(percentage <= 60.0)
  302.          {
  303.           c.println("I think you could do better, why not try again?");
  304.          }
  305.          else
  306.          {
  307.           c.println("Great Job!");
  308.          String continue = c.readLine();
  309.          }
  310.          }
  311.          while(continue=("yes"));
  312.         }
  313.        
  314. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement