Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The "Summative" class.
- import java.awt.*;
- import hsa.Console;
- public class Summative
- {
- static Console c; // The output console
- public static void main (String[] args )throws InterruptedException
- {
- c = new Console ();
- //Test Score Counter
- double quizScore = 0;
- //Title Page
- c.println(" _____ _ _ _____ _ ");
- c.println(" |_ _| | | | | | __ \\ (_) ");
- c.println(" | | _ __ | |_ ___ _ __ _ __ ___| |_ | |__) | __ ___ ____ _ ___ _ _ ");
- c.println(" | | | '_ \\| __/ _ \\ '__| '_ \\ / _ \\ __| | ___/ '__| \\ \\ / / _` |/ __| | | |");
- c.println(" _| |_| | | | || __/ | | | | | __/ |_ | | | | | |\\ V / (_| | (__| |_| |");
- c.println(" |_____|_| |_|\\__\\___|_| |_| |_|\\___|\\__| |_| |_| |_| \\_/ \\__,_|\\___|\\__, |");
- c.println(" __/ |");
- c.println(" |___/ ");
- c.println(" ____ _ ");
- c.println(" / __ \\ (_) ");
- c.println(" | | | |_ _ _ ____");
- c.println(" | | | | | | | |_ /");
- c.println(" | |__| | |_| | |/ / ");
- c.println(" \\___\\_\\\\__,_|_/___|");
- c.println("");
- c.println("");
- c.println("");
- c.println("");
- c.println("");
- c.println("");
- c.println("");
- c.println("");
- c.println("");
- c.setTextColor(Color.red);
- c.println("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- do
- {
- //Lock
- c.setColor(new Color(255, 204, 153));
- c.drawRect(490,350,100,100);
- c.fillRect(490,350,100,100);
- c.setColor(Color.black);
- c.fillOval(521,370,40,40);
- c.fillRect(531,380,20,50);
- c.setColor(new Color(191, 191, 191));
- c.fillRect(500,310,20,40);
- c.fillRect(562,310,20,40);
- c.fillRect(500,300,82,15);
- c.setColor(Color.black);
- //Disclaimer
- c.println("NOTE: YOU ARE NOT TOLD WHETHER YOUR ANSWER IS RIGHT OR WRONG RIGHT AWAY");
- c.println("YOUR SCORE IS PRESENTED AT THE END OF THE QUIZ");
- c.println("");
- c.println("");
- c.println("");
- c.println("");
- c.setTextColor(Color.red);
- c.print("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- //Lock
- c.setColor(new Color(255, 204, 153));
- c.drawRect(490,350,100,100);
- c.fillRect(490,350,100,100);
- c.setColor(Color.black);
- c.fillOval(521,370,40,40);
- c.fillRect(531,380,20,50);
- c.setColor(new Color(191, 191, 191));
- c.fillRect(500,310,20,40);
- c.fillRect(562,310,20,40);
- c.fillRect(500,300,82,15);
- c.setColor(Color.black);
- //First Question
- c.println("In what year did Edward Snowden leak the NSA files to the public?");
- c.println("A-2005");
- c.println("B-2014");
- c.println("C-2013");
- String userAnswer = c.readLine();
- if (userAnswer.equalsIgnoreCase("C"))
- {
- c.setTextColor(Color.red);
- c.println("Thank you, please move onto the next question");
- c.setTextColor(Color.black);
- quizScore = quizScore + 1;
- c.setTextColor(Color.red);
- c.println("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- }
- else
- {
- c.setTextColor(Color.red);
- c.println("Thank you, please move onto the next question");
- c.setTextColor(Color.black);
- c.setTextColor(Color.red);
- c.println("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- }
- //Lock
- c.setColor(new Color(255, 204, 153));
- c.drawRect(490,350,100,100);
- c.fillRect(490,350,100,100);
- c.setColor(Color.black);
- c.fillOval(521,370,40,40);
- c.fillRect(531,380,20,50);
- c.setColor(new Color(191, 191, 191));
- c.fillRect(500,310,20,40);
- c.fillRect(562,310,20,40);
- c.fillRect(500,300,82,15);
- c.setColor(Color.black);
- //Second Question
- c.println("Which one of these things does the facebook app need permission for?");
- c.println("A-Device ID & Call Information");
- c.println("B-Location");
- c.println("C-Device & App History");
- c.println("D-All of the above");
- String userAnswerTwo = c.readLine();
- if (userAnswerTwo.equalsIgnoreCase("D"))
- {
- c.setTextColor(Color.red);
- c.println("Thank you, please move onto the next question");
- c.setTextColor(Color.black);
- quizScore = quizScore + 1;
- c.println("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- }
- else
- {
- c.setTextColor(Color.red);
- c.println("Thank you, please move onto the next question");
- c.setTextColor(Color.black);
- c.println("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- }
- //Lock
- c.setColor(new Color(255, 204, 153));
- c.drawRect(490,350,100,100);
- c.fillRect(490,350,100,100);
- c.setColor(Color.black);
- c.fillOval(521,370,40,40);
- c.fillRect(531,380,20,50);
- c.setColor(new Color(191, 191, 191));
- c.fillRect(500,310,20,40);
- c.fillRect(562,310,20,40);
- c.fillRect(500,300,82,15);
- c.setColor(Color.black);
- //Third Question
- c.println("What was Ryan Kazaryan charged for?");
- c.println("A-Taking pictures of people naked, and blackmailing");
- c.println("B-Selling people's personal information");
- c.println("C-Leaking top-secret NSA files");
- String userAnswerThree = c.readLine();
- if (userAnswerThree.equalsIgnoreCase("A"))
- {
- c.setTextColor(Color.red);
- c.println("Thank you, please move onto the next question");
- c.setTextColor(Color.black);
- quizScore = quizScore + 1;
- c.println("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- }
- else
- {
- c.setTextColor(Color.red);
- c.println("Thank you, please move onto the next question");
- c.setTextColor(Color.black);
- c.println("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- }
- //Lock
- c.setColor(new Color(255, 204, 153));
- c.drawRect(490,350,100,100);
- c.fillRect(490,350,100,100);
- c.setColor(Color.black);
- c.fillOval(521,370,40,40);
- c.fillRect(531,380,20,50);
- c.setColor(new Color(191, 191, 191));
- c.fillRect(500,310,20,40);
- c.fillRect(562,310,20,40);
- c.fillRect(500,300,82,15);
- c.setColor(Color.black);
- //Fourth Question
- c.println("What ISP is the worst at following Canadian privacy guidelines?");
- c.println("A-Shaw");
- c.println("B-Storm Internet");
- c.println("C-Acanac");
- String userAnswerFour = c.readLine();
- if (userAnswerFour.equalsIgnoreCase("C"))
- {
- c.setTextColor(Color.red);
- c.println("Thank you, please move onto the next question");
- c.setTextColor(Color.black);
- quizScore = quizScore + 1;
- c.println("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- }
- else
- {
- c.setTextColor(Color.red);
- c.println("Thank you, please move onto the next question");
- c.setTextColor(Color.black);
- c.println("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- }
- //Lock
- c.setColor(new Color(255, 204, 153));
- c.drawRect(490,350,100,100);
- c.fillRect(490,350,100,100);
- c.setColor(Color.black);
- c.fillOval(521,370,40,40);
- c.fillRect(531,380,20,50);
- c.setColor(new Color(191, 191, 191));
- c.fillRect(500,310,20,40);
- c.fillRect(562,310,20,40);
- c.fillRect(500,300,82,15);
- c.setColor(Color.black);
- //Fifth Question
- c.println("What's the most fool proof way to ensure your privacy is safe on the internet?");
- c.println("A-Avoid all social media websites");
- c.println("B-Don't use the internet at all");
- c.println("C-Upload your information only on sites you trust");
- String userAnswerFive = c.readLine();
- if (userAnswerFive.equalsIgnoreCase("B"))
- {
- c.setTextColor(Color.red);
- c.println("Thank you, please move onto the next question");
- c.setTextColor(Color.black);
- quizScore = quizScore + 1;
- c.println("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- }
- else
- {
- c.setTextColor(Color.red);
- c.println("Thank you, please move onto the next question");
- c.setTextColor(Color.black);
- c.println("Please press any key to continue...");
- c.setTextColor(Color.black);
- c.getChar();
- c.clear();
- }
- //Lock
- c.setColor(new Color(255, 204, 153));
- c.drawRect(490,350,100,100);
- c.fillRect(490,350,100,100);
- c.setColor(Color.black);
- c.fillOval(521,370,40,40);
- c.fillRect(531,380,20,50);
- c.setColor(new Color(191, 191, 191));
- c.fillRect(500,310,20,40);
- c.fillRect(562,310,20,40);
- c.fillRect(500,300,82,15);
- c.setColor(Color.black);
- //End of the quiz
- double percentage = quizScore/5;
- percentage = percentage * 100;
- c.println("Thank you for completing this quiz!");
- c.println("Your score was " + quizScore + " out of 5");
- c.println("Which was " + percentage + "%");
- if(percentage <= 60.0)
- {
- c.println("I think you could do better, why not try again?");
- }
- else
- {
- c.println("Great Job!");
- String continue = c.readLine();
- }
- }
- while(continue=("yes"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement