/*Interactive Course Simulator: Computer Science 2017 *June 15th, 2017 *By Kevin, Jatin and Owen *This game serves to emulate the experience of the grade 11 computer science course TITLE SCREEN CODE *************************************************************************************** using System; using System.Drawing; using System.Drawing.Text; using System.IO; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; namespace prjICS { public partial class TitleScreen : Form { /************ **Variables** ************/ public static String playerName = "";//player's name public static Boolean loadLastGame = false;//if you have a save file /************ **Functions** ************/ void textScroll(int milliseconds, string text, Label label)//scrolls the input text at the speed of the inputed number of milliseconds. this is assigned to an inputed label { label.Text = "";//resets the label to have no string for (int x = 0; x < text.Length; x++)//for loop to gain each character from the input string and add it to the label with a delay. this causes the text scroll effect. { String character = text.Substring(x, 1);//gets the character at the position of the number of iterations the for loop had gone through label.Text += character;//adds the character to the label string Thread.Sleep(milliseconds);//delay label.Update();//updates screen } } void setFont() { PrivateFontCollection pfc = new PrivateFontCollection();//variable for the font file pfc.AddFontFile("acme_explosive.TTF");//font file foreach(Control c in Controls)//cycles through the diffrent contols and sets the font { c.Font = new Font(pfc.Families[0], c.Font.Size - 4); } } public TitleScreen() { InitializeComponent(); } private void lblStart_Click(object sender, EventArgs e) { /*This section sets the playerName variable to * whatever the user inputted, then loads the game * (Form1) and hides the name input window (Form2).*/ playerName = txtName.Text;//gets the player name from txtName.Text; Classroom frm = new Classroom();//changes to the classroom form frm.Show(); this.Hide(); } private void lblHelp_Click(object sender, EventArgs e) { /*HelpMenu frm = new HelpMenu(); frm.Show(); this.Hide();*/ SebnicMenu frm = new SebnicMenu();//changes to the help form frm.Show(); this.Hide(); } private void Menu_Shown(object sender, EventArgs e) { setFont();//sets the font of the form lblTitle.Text = ""; textScroll(40, "Interactive Course Simulator: Computer Science 2017", lblTitle);//scrolls the title screen text lblNew.Visible = true;//turns on the controls of the form lblLoad.Visible = true; lblHelp.Visible = true; } private void txtName_TextChanged(object sender, EventArgs e) { if (txtName.Text.Length > 15)//limits your name to 15 characters { txtName.Text = txtName.Text.Remove(txtName.Text.Length - 1, 1);//removes the last character of the string } if (txtName.Text!="")//turns on the start game button when txt.Name does not equal to a blank string { lblStart.Visible = true; lblWarning.Visible = true; } else//otherwise, it will not { lblStart.Visible = false; lblWarning.Visible = false; } } private void lblNew_Click(object sender, EventArgs e) { loadLastGame = false;//sets loadLastGame to false so when the classroom loads, it does not load your save file lblNamePrompt.Visible = true;//this makes the namePrompt label visible lblNamePrompt.Text = "";//resets the namePrompt label to a blank string textScroll(40, "Enter Your Name:", lblNamePrompt);//scrolls the enter name text txtName.Visible = true;//makes the textbox for the input of your name visible } private void lblLoad_Click(object sender, EventArgs e) { if (File.Exists("data.txt"))//checks if data.txt exists in the files { loadLastGame = true;//sets loadLastGame to true so when the classroom loads, it loads your save file Classroom frm = new Classroom();//opens the classroom form frm.Show(); this.Hide(); } else { lblNoSave.Visible = true;//makes the noSave label visible. (shows that you have no save file) } } } } TEST CODE ****************************************************************************************** using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace prjICS { public partial class Test : Form { //Basicly a copy and paste of the lesson form except for minor changes. Any changes will be documented. Otherwise, it is already documented in the lesson form. /************ **Variables** ************/ public static int rightAnswers = 0; int question = 1; /************ **Functions** ************/ void correctAnswer() { MessageBox.Show("Correct"); rightAnswers++; question++; if (question >= 11)//checks if you went through all 10 questions { TaskEnd frm = new TaskEnd(); frm.Show(); this.Hide(); } else { loadQuestion(SebnicMenu.unitTestSelected, question); } } void wrongAnswer() { MessageBox.Show("Incorrect"); question++; if (question >= 11)//checks if you went through all 10 questions { TaskEnd frm = new TaskEnd(); frm.Show(); this.Hide(); } else { loadQuestion(SebnicMenu.unitTestSelected, question); } } void uncheckButtons() { rb1.Checked = false; rb2.Checked = false; rb3.Checked = false; rb4.Checked = false; } void checkAnswer(RadioButton rb) { if (rb.Checked == true) { correctAnswer(); } else { wrongAnswer(); } } void loadQuestion(int unit, int question)//these questions are from the lesson forms. { if (unit == 1) { if (question == 1) { pbImage.Image = null; lblDialogue.Text = "One of the following is not a programming language"; rb1.Text = "C#"; rb2.Text = "F#"; rb3.Text = "Microsoft Word";//Correct rb4.Text = "Java"; } else if (question == 2) { pbImage.Image = null; lblDialogue.Text = "What is your teacher's name?"; rb1.Text = "Mr. Goodwin"; rb2.Text = "Mr. Krnic";//Correct rb3.Text = "Mr. Hajatri"; rb4.Text = "Mr. Cacarovski"; } else if (question == 3) { pbImage.Image = null; lblDialogue.Text = "What is code?"; rb1.Text = "A secret message sent from one computer to another"; rb2.Text = "A set of instructions that tell a computer what to do";//Correct rb3.Text = "Numbers"; rb4.Text = "The components inside the computer"; } else if (question == 4) { pbImage.Image = null; lblDialogue.Text = "What is the difference between markup and programming languages?"; rb1.Text = "Programming determines how something looks, \nmarkup determines how it behaves"; rb2.Text = "They are the same"; rb3.Text = "Markup determines how something looks, \nprogramming determines how it behaves";//Correct rb4.Text = "A programming language is for robots, \nmarkup languages are for computers."; } else if (question == 5) { pbImage.Image = Properties.Resources.filepaths; lblDialogue.Text = "What is the RELATIVE path from 'D:' to 'Infrastructure'?"; rb1.Text = "../Data/Final/Infrastructure"; rb2.Text = "Landuse/Shapefiles/Final/Infrastructure"; rb3.Text = "Data/Final/Infrastructure";//Correct rb4.Text = "D:/Data/Final/Infrastructure"; } else if (question == 6) { pbImage.Image = Properties.Resources.filepaths; lblDialogue.Text = "What is the ABOSLUTE path to 'Posters'?"; rb1.Text = "../Maps/Posters"; rb2.Text = "D:/Data/Shapefiles/Soils"; rb3.Text = "D:/Maps/Posters";//Correct rb4.Text = "../../D:/Data/Posters"; } else if (question == 7) { pbImage.Image = null; lblDialogue.Text = "Convert '100101010' from binary to decimal."; rb1.Text = "542"; rb2.Text = "562"; rb3.Text = "12A"; rb4.Text = "298";//Correct } else if (question == 8) { pbImage.Image = null; lblDialogue.Text = "Convert '10010' from decimal to hex."; rb1.Text = "342"; rb2.Text = "271A"; rb3.Text = "12";//Correct rb4.Text = "FF"; } else if (question == 9) { pbImage.Image = Properties.Resources.css; lblDialogue.Text = "In the image to the left, in what colour is the PROPERTY highlighted?"; rb1.Text = "Green"; rb2.Text = "Orange";//Correct rb3.Text = "Blue"; rb4.Text = "Teal"; } else if (question == 10) { pbImage.Image = Properties.Resources.css; lblDialogue.Text = "In the image to the left, in what colour is the VALUE highlighted?"; rb1.Text = "Green"; rb2.Text = "Orange"; rb3.Text = "Blue"; rb4.Text = "Teal";//Correct } } else if (unit == 2) { if (question == 1) { pbImage.Image = null; lblDialogue.Text = "Properties effect the _____ and _____ of a control"; rb1.Text = "Event, Code"; rb2.Text = "Authouity, Properties"; rb3.Text = "Appearance, Behavior";//Correct rb4.Text = "Memory, Computing"; } else if (question == 2) { pbImage.Image = null; lblDialogue.Text = "Properties can be changed during _____ and _____"; rb1.Text = "Run Time, Design Time";//Correct rb2.Text = "Launch, Exit"; rb3.Text = "Christmas, 1815"; rb4.Text = "Noon, Midnight"; } else if (question == 3) { pbImage.Image = Properties.Resources.textboxName; lblDialogue.Text = "Given the picture, what is the proper name of the textbox"; rb1.Text = "textbox1"; rb2.Text = "tbName"; rb3.Text = "lblName"; rb4.Text = "txtName";//Correct } else if (question == 4) { pbImage.Image = null; lblDialogue.Text = "What variable type does textbox.Text accept?"; rb1.Text = "A Boolean"; rb2.Text = "An Int"; rb3.Text = "A String";//Correct rb4.Text = "A Double"; } else if (question == 5) { pbImage.Image = null; lblDialogue.Text = "Code in an if statement is only executed when:"; rb1.Text = "The Condition Is False"; rb2.Text = "The Condition Is True";//Correct rb3.Text = "The Condition Is Sort Of True"; rb4.Text = "It Is Always Executed"; } else if (question == 6) { pbImage.Image = null; lblDialogue.Text = "Will the if statement be executed? If ((10 * 4) / 2 < 17)"; rb1.Text = "Yes"; rb2.Text = "No";//Correct rb3.Text = "Maybe"; rb4.Text = "I'm Stumped"; } else if (question == 7) { pbImage.Image = null; lblDialogue.Text = "Will the if statement be executed? If ((40 * 3) / 2 <= 360 / 6 && 32 – 4 > 63 / 3)"; rb1.Text = "Yes";//Correct rb2.Text = "No"; rb3.Text = "Maybe"; rb4.Text = "I'm Stumped"; } else if (question == 8) { pbImage.Image = null; lblDialogue.Text = "Will the code in the if statement be executed? If ((245 / 5) / 7 == 9 / 3 + 4 || 5 – 2 < 78 – 70 && 96 * 0 + 2 == (5 – 4) * 2)"; rb1.Text = "Yes"; rb2.Text = "No";//Correct rb3.Text = "Maybe"; rb4.Text = "I'm Stumped"; } else if (question == 9) { pbImage.Image = null; lblDialogue.Text = "How many times will this for loop iterate: for (int x=7; x<3 ; x -= 1)"; rb1.Text = "0 Times";//Correct rb2.Text = "4 Times"; rb3.Text = "5 Times"; rb4.Text = "Infinite Times"; } else if (question == 10) { pbImage.Image = null; lblDialogue.Text = "How many times will this for loop iterate: for (int x=0; x < 2 * 2 * 2 ; x++)"; rb1.Text = "4 Times"; rb2.Text = "8 Times";//Correct rb3.Text = "2 times"; rb4.Text = "Infinite Times"; } } else if (unit == 3) { if (question == 1) { pbImage.Image = null; lblDialogue.Text = "What Does PDT Stand for?"; rb1.Text = "Programming Data Transfer"; rb2.Text = "Point Data Table"; rb3.Text = "Problem Definition Table";//this one. rb4.Text = "Pretty Dumb Thing"; } else if (question == 2) { pbImage.Image = null; lblDialogue.Text = "What’s the first step in the Software Development Cycle?"; rb1.Text = "Create Algorithm"; rb2.Text = "Identify the Problem ";//this one rb3.Text = "Implement the Algorithm"; rb4.Text = "Maintenance"; } else if (question == 3) { pbImage.Image = null; lblDialogue.Text = "What does IPO Stand for?"; rb1.Text = "Inside Present Outside"; rb2.Text = "Integrated Percentage Output"; rb3.Text = "Input Processing Output";//this one rb4.Text = "Industrial Pollution Omitted"; } else if (question == 4) { pbImage.Image = null; lblDialogue.Text = "Which column is used for equations?"; rb1.Text = "Input"; rb2.Text = "Processing";//this one rb3.Text = "Output"; rb4.Text = "No equations required."; } else if (question == 5) { pbImage.Image = null; lblDialogue.Text = "In a flowchart, what shape is used for multiple outcomes?"; rb1.Text = "Parallelogram"; rb2.Text = "Diamond";//this one rb3.Text = " Rectangle"; rb4.Text = "Oval"; } else if (question == 6) { pbImage.Image = null; lblDialogue.Text = "True or False: Pseudocode is the same as C#."; rb1.Text = " True"; rb2.Text = "False";//this one rb3.Text = "random garbage"; rb4.Text = "random garbage"; } else if (question == 7) { pbImage.Image = null; lblDialogue.Text = "Why is internet piracy considered illegal?"; rb1.Text = "It’s considered stealing over the internet.";//this one rb2.Text = "It’s illegal to be a pirate. ARRGH!"; rb3.Text = "It is not considered a crime."; rb4.Text = "It is not considered a crime."; } else if (question == 8) { pbImage.Image = null; lblDialogue.Text = "What is the basic definition of hacking?"; rb1.Text = "Obtaining cheat codes for video games"; rb2.Text = "Gaining unauthorized access to a computer."; ;//this one. rb3.Text = "Stealing someone’s USB."; rb4.Text = "Looking through security cameras."; } else if (question == 9) { pbImage.Image = null; lblDialogue.Text = "Which of these careers can you get into with a degree in Computer Science?"; rb1.Text = "Software Engineer."; rb2.Text = "Systems Analyst."; rb3.Text = "Web developer"; rb4.Text = "All of the Above.";//this one } else if (question == 10) { pbImage.Image = null; lblDialogue.Text = "What is e-waste?"; rb1.Text = "Digitally removing old files from your computer."; rb2.Text = "Throwing out your computer."; rb3.Text = "Re-using components of electronics for future life.";//this one. rb4.Text = "Removing Hard Drive from computer."; } } else if (unit == 4) { if (question == 1) { pbImage.Image = null; lblDialogue.Text = "What does a scope of a variable determine?"; rb1.Text = "Its accessibility.";//this one. rb2.Text = "How Large the variable is."; rb3.Text = "The type"; rb4.Text = "None of the Above."; } else if (question == 2) { pbImage.Image = null; lblDialogue.Text = "What is a variable's scope normally limited to?"; rb1.Text = "Its Value"; rb2.Text = "Its Block";//this one rb3.Text = "Whether or not it is a Boolean"; rb4.Text = "If it's a int or a double."; } else if (question == 3) { pbImage.Image = null; lblDialogue.Text = "What is Modular Programming?"; rb1.Text = "A method for modding games."; rb2.Text = "A method for reusing blocks of code.";//this one rb3.Text = "A method for solving Algorithms."; rb4.Text = "A method to average the sum of numbers."; } else if (question == 4) { pbImage.Image = null; lblDialogue.Text = "What is a benefit of Modular Programming?"; rb1.Text = "Efficient programming"; rb2.Text = "Code is more readable and easier to understand"; rb3.Text = "Smaller file size, therefore faster"; rb4.Text = "All of the above.";//this one } else if (question == 5) { pbImage.Image = null; lblDialogue.Text = "Which of these String Functions doesn't exist?"; rb1.Text = "Compare"; rb2.Text = "Concat"; rb3.Text = "ToUpper"; rb4.Text = "LowerLetters";//this one } else if (question == 6) { pbImage.Image = null; lblDialogue.Text = "Let's use the word 'Computerized.' Using the function, IndexOf('e',5) will return:"; rb1.Text = "1"; rb2.Text = "6";//this one rb3.Text = "10"; rb4.Text = "e"; } else if (question == 7) {//to be added } else if (question == 8) { } else if (question == 9) { } else if (question == 10) { } } } public Test() { InitializeComponent(); } private void Test_Load(object sender, EventArgs e) { uncheckButtons(); lblUnitTest.Text = "Unit " + SebnicMenu.unitTestSelected + " Test";//shows what unit test you are being tested on lblName.Text = TitleScreen.playerName; question = 1; rightAnswers = 0; loadQuestion(SebnicMenu.unitTestSelected, question); } private void lblSubmit_Click(object sender, EventArgs e) { if (SebnicMenu.unitTestSelected == 1) { if (question == 1) { checkAnswer(rb3); } else if (question == 2) { checkAnswer(rb2); } else if (question == 3) { checkAnswer(rb2); } else if (question == 4) { checkAnswer(rb3); } else if (question == 5) { checkAnswer(rb3); } else if (question == 6) { checkAnswer(rb3); } else if (question == 7) { checkAnswer(rb4); } else if (question == 8) { checkAnswer(rb3); } else if (question == 9) { checkAnswer(rb2); } else if (question == 10) { checkAnswer(rb4); } } else if (SebnicMenu.unitTestSelected == 2) { if (question == 1) { checkAnswer(rb3); } else if (question == 2) { checkAnswer(rb1); } else if (question == 3) { checkAnswer(rb4); } else if (question == 4) { checkAnswer(rb3); } else if (question == 5) { checkAnswer(rb2); } else if (question == 6) { checkAnswer(rb2); } else if (question == 7) { checkAnswer(rb1); } else if (question == 8) { checkAnswer(rb2); } else if (question == 9) { checkAnswer(rb1); } else if (question == 10) { checkAnswer(rb2); } } if (SebnicMenu.unitTestSelected == 3) { if (question == 1) { checkAnswer(rb3); } else if (question == 2) { checkAnswer(rb2); } else if (question == 3) { checkAnswer(rb3); } else if (question == 4) { checkAnswer(rb2); } else if (question == 5) { checkAnswer(rb2); } else if (question == 6) { checkAnswer(rb2); } else if (question == 7) { checkAnswer(rb1); } else if (question == 8) { checkAnswer(rb2); } else if (question == 9) { checkAnswer(rb4); } else if (question == 10) { checkAnswer(rb3); } } if (SebnicMenu.unitTestSelected == 4) { if (question == 1) { checkAnswer(rb1); } else if (question == 2) { checkAnswer(rb2); } else if (question == 3) { checkAnswer(rb2); } else if (question == 4) { checkAnswer(rb4); } else if (question == 5) { checkAnswer(rb4); } else if (question == 6) { checkAnswer(rb2); } else if (question == 7) { } else if (question == 8) { } else if (question == 9) { } else if (question == 10) { } } uncheckButtons(); } } } TASKEND CODE *************************************************************************************** using System; using System.Drawing; using System.Drawing.Text; using System.Threading; using System.Windows.Forms; namespace prjICS { public partial class TaskEnd : Form { void textScroll(int milliseconds, string text, Label label)//Same Textscroll from the title screen form. see documentation in that form { label.Text = ""; for (int x = 0; x < text.Length; x++) { String character = text.Substring(x, 1); label.Text += character; Thread.Sleep(milliseconds); label.Update(); } } void setFont()//Same setFont from the title screen form. see documentation in that form { PrivateFontCollection pfc = new PrivateFontCollection(); pfc.AddFontFile("acme_explosive.TTF"); foreach (Control c in Controls) { c.Font = new Font(pfc.Families[0], c.Font.Size - 4); } } public TaskEnd() { InitializeComponent(); } private void LessonEnd_Shown(object sender, EventArgs e) { lblLessonEndText.Text = ""; this.Refresh(); if (SebnicMenu.lesson == true)//if you did a lesson { Double rightAnswers = Lesson.rightAnswers; Double lessonMark = (rightAnswers / 5) * 100;//calculates your mark if (SebnicMenu.lessonNum == 1)//sets what lesson was just attempted { SebnicMenu.lesson1Attempted = true; } else if (SebnicMenu.lessonNum == 2) { SebnicMenu.lesson2Attempted = true; } else if (SebnicMenu.lessonNum == 3) { SebnicMenu.lesson3Attempted = true; } else if (SebnicMenu.lessonNum == 4) { SebnicMenu.lesson4Attempted = true; } else if (SebnicMenu.lessonNum == 5) { SebnicMenu.lesson5Attempted = true; } //textscroll the unit, lesson and your score textScroll(30, "Unit " + SebnicMenu.currentUnitTab + " Lesson " + SebnicMenu.lessonNum + " completed!\nYou scored:\n\n" + Lesson.rightAnswers + " out of 5\n" + lessonMark + "%", lblLessonEndText); } else if (SebnicMenu.test == true) { Double rightAnswers = Test.rightAnswers; Double testMark = (rightAnswers / 10) * 100;//calculates your mark //textscroll unit, and score textScroll(30, "Unit " + Classroom.unit + " Test completed!\nYou scored:\n\n" + Test.rightAnswers + " out of 10\n" + testMark + "%", lblLessonEndText); //resets what lessons have been attempted SebnicMenu.lesson1Attempted = false; SebnicMenu.lesson2Attempted = false; SebnicMenu.lesson3Attempted = false; SebnicMenu.lesson4Attempted = false; SebnicMenu.lesson5Attempted = false; } } private void lblBack_Click(object sender, EventArgs e) { Classroom.day++;//moves on to the next day //shows the clasroom form Classroom frm = new Classroom(); frm.Show(); this.Hide(); } } } SEBNIC MENU CODE ********************************************************************************************************* using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace prjICS { public partial class SebnicMenu : Form { /************ **Variables** ************/ public static int currentUnitTab = 1;//the unit tab that you are on public static int lessonNum = 1;//the lesson number you picked public static int unitTestSelected = 0;//the unit test number you picked public static Boolean lesson1Attempted = false;//*self explanitory public static Boolean lesson2Attempted = false;// public static Boolean lesson3Attempted = false;// public static Boolean lesson4Attempted = false;// public static Boolean lesson5Attempted = false;//* public static Boolean lesson = false;//if you are doing a lesson public static Boolean test = false;//if you are doing a test public static Boolean assignment = false;//if you are doing an assignment public static int daysBeforeTest = 0;//number of days before a test is manditory /************ **Functions** ************/ /*int dayConvert(int unit, int lesson) { int day = (unit * 5 - 5) + lesson; return day; }*/ /*only pop up a lesson if the previous lesson has been attempted */ void allVisibilityOff()//turns the visibility off for all lesson, test, and assignment labels, and the tabel panel. { visibilityOff(); lblUnit4Test.Visible = false; lblUnit3Test.Visible = false; lblUnit2Test.Visible = false; lblUnit1Test.Visible = false; lblUnit2Assignment.Visible = false; lblUnit4Assignment.Visible = false; tlpTests.Visible = false; } void visibilityOff()//turns the visibility off for all lesson labels { lblLesson5.Visible = false; lblLesson4.Visible = false; lblLesson3.Visible = false; lblLesson2.Visible = false; lblLesson1.Visible = false; } void visibilityOn()//turns the visibility on for all lesson labels { lblLesson5.Visible = true; lblLesson4.Visible = true; lblLesson3.Visible = true; lblLesson2.Visible = true; lblLesson1.Visible = true; } void unboldUnits()//unbold all unit tab labels { lblUnit1.Font = new Font(lblUnit1.Font, FontStyle.Regular); lblUnit2.Font = new Font(lblUnit2.Font, FontStyle.Regular); lblUnit3.Font = new Font(lblUnit3.Font, FontStyle.Regular); lblUnit4.Font = new Font(lblUnit4.Font, FontStyle.Regular); } void unitVisibilityCheck()//determines what label should be visible depending on what unit you are on { if (lesson5Attempted == true)//if lesson 5 has been attempted { visibilityOn(); if (Classroom.unit == 4) { if (daysBeforeTest != 3)//this lets you do the test and the lessons { lblUnit4Test.Visible = true; tlpTests.Visible = true; } else//this hides everything except for the test { allVisibilityOff(); lblUnit4Test.Visible = true; tlpTests.Visible = true; } } else if (Classroom.unit == 3) { if (daysBeforeTest != 3)//this lets you do the test and the lessons { lblUnit3Test.Visible = true; tlpTests.Visible = true; } else//this hides everything except for the test { allVisibilityOff(); lblUnit3Test.Visible = true; tlpTests.Visible = true; } } else if (Classroom.unit == 2) { if (daysBeforeTest != 3)//etc.............. { lblUnit2Test.Visible = true; tlpTests.Visible = true; } else { allVisibilityOff(); lblUnit2Test.Visible = true; tlpTests.Visible = true; } } else if (Classroom.unit == 1) { if (daysBeforeTest != 3) { lblUnit1Test.Visible = true; tlpTests.Visible = true; } else { allVisibilityOff(); lblUnit1Test.Visible = true; tlpTests.Visible = true; } } } else if (Classroom.unit == currentUnitTab)//if the unit is equal to the unit tab that you are on { lessonVisibilityCheck();//checks what lessons should be shown } else if (Classroom.unit > currentUnitTab)//if the unit is greater than the unit tab that you are on { visibilityOn(); } else { visibilityOff(); } } void lessonVisibilityCheck() { allVisibilityOff(); if (lesson5Attempted == true) { visibilityOn(); if (Classroom.unit == 4)//checks what unit you are on and picks what test should be shown { if (daysBeforeTest != 3)//shows test with lessons { lblUnit4Test.Visible = true; tlpTests.Visible = true; daysBeforeTest++;//adds to the days before a test } else//shows test without lessons { allVisibilityOff(); lblUnit4Test.Visible = true; tlpTests.Visible = true; } } else if (Classroom.unit == 3)//etc............. { if (daysBeforeTest != 3) { lblUnit3Test.Visible = true; tlpTests.Visible = true; daysBeforeTest++; } else { allVisibilityOff(); lblUnit3Test.Visible = true; tlpTests.Visible = true; } } else if (Classroom.unit == 2) { if (daysBeforeTest != 3) { lblUnit2Test.Visible = true; tlpTests.Visible = true; daysBeforeTest++; } else { allVisibilityOff(); lblUnit2Test.Visible = true; tlpTests.Visible = true; } } else if (Classroom.unit == 1) { if (daysBeforeTest != 3) { lblUnit1Test.Visible = true; tlpTests.Visible = true; daysBeforeTest++; } else { allVisibilityOff(); lblUnit1Test.Visible = true; tlpTests.Visible = true; } } } else if (lesson4Attempted == true || currentUnitTab < Classroom.unit)//if lesson4 had been attempted or the current unit tab is less than the actual unit { visibilityOn();//turn all lesson labels on } else if (lesson3Attempted == true)//if lesson 3 has been attempted { lblLesson5.Visible = false;//turns all lesson labels on except for #5 lblLesson4.Visible = true; lblLesson3.Visible = true; lblLesson2.Visible = true; lblLesson1.Visible = true; } else if (lesson2Attempted == true) { lblLesson5.Visible = false;//turns all lesson labels on except for #5, #4 lblLesson4.Visible = false; lblLesson3.Visible = true; lblLesson2.Visible = true; lblLesson1.Visible = true; } else if (lesson1Attempted == true) { lblLesson5.Visible = false;//turns all lesson labels on except for #5, #4 #3 lblLesson4.Visible = false; lblLesson3.Visible = false; lblLesson2.Visible = true; lblLesson1.Visible = true; } else { lblLesson5.Visible = false;//turns all lesson labels off except for #1 lblLesson4.Visible = false; lblLesson3.Visible = false; lblLesson2.Visible = false; lblLesson1.Visible = true; } } public SebnicMenu() { InitializeComponent(); } private void lblBack_Click(object sender, EventArgs e) { //sends you to the classroom form Classroom frm = new Classroom(); frm.Show(); this.Hide(); } private void SebnicMenu_Load(object sender, EventArgs e) { lblMark.Text = "Current Mark: " + Classroom.courseMark + "%";//shows your current mark currentUnitTab = 1; lesson = false; test = false; assignment = false; //unit description lblDescription.Text = "This unit focuses on basic computer and information science skills. Students identify hardware components, research ergonomic considerations, practise file management skills, access resources through local and wide area networks, and research the evolution of programming languages. They develop skills for success in the computer and information science environment. Students focus on the Computer and Information Science environment; students also examine respect for the environment and wise use of resources from a responsible perspective."; lessonVisibilityCheck();//checks what lessons should be visible } private void lblUnit1_Click(object sender, EventArgs e) { unboldUnits();//unbolds all unit tabs lblUnit1.Font = new Font(lblUnit1.Font, FontStyle.Bold);//makes the unit 1 tab bolded currentUnitTab = 1; //unit description lblDescription.Text = "This unit focuses on basic computer and information science skills. Students identify hardware components, research ergonomic considerations, practise file management skills, access resources through local and wide area networks, and research the evolution of programming languages. They develop skills for success in the computer and information science environment. Students focus on the Computer and Information Science environment; students also examine respect for the environment and wise use of resources from a responsible perspective."; unitVisibilityCheck();//determines what label should be visible depending on what unit you are on lessonNum = 0; } private void lblUnit2_Click(object sender, EventArgs e) { unboldUnits();//etc..................... lblUnit2.Font = new Font(lblUnit2.Font, FontStyle.Bold); currentUnitTab = 2; lblDescription.Text = "This unit focuses on basic programming structures. Students write simple programs, using variable assignment, repetition, and decision structures, and develop effective testing, validating, and documenting skills. They also explore roles of effective communicators and reflective thinkers when following a problem-solving model (e.g., user inputs a series of marks, each value is validated, the average is calculated, and a grade is assigned)."; unitVisibilityCheck(); lessonNum = 0; } private void lblUnit3_Click(object sender, EventArgs e) { unboldUnits(); lblUnit3.Font = new Font(lblUnit3.Font, FontStyle.Bold); currentUnitTab = 3; lblDescription.Text = "This unit focuses on using problem solving strategies in the computer science field as well as investigation into societal issues involving computer technology. This includes an exploration of careers in computer studies. Students also examine issues surrounding privacy, security, and ethical use of information."; unitVisibilityCheck(); lessonNum = 0; } private void lblUnit4_Click(object sender, EventArgs e) { unboldUnits(); lblUnit4.Font = new Font(lblUnit4.Font, FontStyle.Bold); currentUnitTab = 4; lblDescription.Text = "This unit focuses on the advanced features of programming. For example students learn about data storage and manipulation. They also write programs that input data from existing files, process the data, and create files for external data storage, following an appropriate problem-solving model (e.g., Create a data file containing employee information including hours worked and rate of pay. Read from the file, compute, display, and write to a new file the gross pay for each employee.). In addition modular programming is introduced. Data structures such as arrays are taught. Common algorithms like the Bubble Sort are examined. Students are expected to incorporate as many of these more complex programming features in their final summative project."; unitVisibilityCheck(); lessonNum = 0; } private void lblLesson1_Click(object sender, EventArgs e) { //lesson # for lesson form lessonNum = 1; lesson = true; //opens the lesson form Lesson frm = new Lesson(); frm.Show(); this.Hide(); } private void lblLesson2_Click(object sender, EventArgs e) { //lesson # for lesson form lessonNum = 2; lesson = true; //opens the lesson form Lesson frm = new Lesson(); frm.Show(); this.Hide(); } private void lblLesson3_Click(object sender, EventArgs e) { //lesson # for lesson form lessonNum = 3; lesson = true; //opens the lesson form Lesson frm = new Lesson(); frm.Show(); this.Hide(); } private void lblLesson4_Click(object sender, EventArgs e) { //lesson # for lesson form lessonNum = 4; lesson = true; //opens the lesson form Lesson frm = new Lesson(); frm.Show(); this.Hide(); } private void lblLesson5_Click(object sender, EventArgs e) { //lesson # for lesson form lessonNum = 5; lesson = true; //opens the lesson form Lesson frm = new Lesson(); frm.Show(); this.Hide(); } private void lblUnit1Test_Click(object sender, EventArgs e) { daysBeforeTest = 0; unitTestSelected = 1; test = true; //opens the test form Test frm = new Test(); frm.Show(); this.Hide(); } private void lblFinal_Click(object sender, EventArgs e) { currentUnitTab = 5; } private void lblUnit2Assignment_Click(object sender, EventArgs e) { } private void lblUnit3Test_Click(object sender, EventArgs e) { daysBeforeTest = 0; unitTestSelected = 3; test = true; //opens the test form Test frm = new Test(); frm.Show(); this.Hide(); } private void lblUnit4Assignment_Click(object sender, EventArgs e) { } private void lblUnit4Test_Click(object sender, EventArgs e) { daysBeforeTest = 0; unitTestSelected = 4; test = true; //opens the test form Test frm = new Test(); frm.Show(); this.Hide(); } private void lblUnit2Test_Click(object sender, EventArgs e) { daysBeforeTest = 0; unitTestSelected = 2; test = true; //opens the test form Test frm = new Test(); frm.Show(); this.Hide(); } //For Unit Test Events: make sure you include this daysBeforeTest = 0; //This will reset the number of days before a test is required to be taken } } LESSON CODE ************************************************************* using System; using System.Windows.Forms; namespace prjICS { public partial class Lesson : Form { /************ **Variables** ************/ public static int rightAnswers = 0;//number of correct answers int question = 1;//determines what question you are on /************ **Functions** ************/ void correctAnswer()//on correct answer { MessageBox.Show("Correct"); rightAnswers++; question++; if (question >= 6)//checks if you went through all 5 questions { //changes form to the TaskEnd form TaskEnd frm = new TaskEnd(); frm.Show(); this.Hide(); } else { //this function will load the next question loadQuestion(SebnicMenu.currentUnitTab, SebnicMenu.lessonNum, question); } } void wrongAnswer()//on wrong answer { MessageBox.Show("Incorrect"); question++; if (question >= 6)//CheckState if you went through all 5 questions { //changes form to the TaskEnd form TaskEnd frm = new TaskEnd(); frm.Show(); this.Hide(); } else { //this function will load the next question loadQuestion(SebnicMenu.currentUnitTab, SebnicMenu.lessonNum, question); } } void uncheckButtons()//unchecks all the radio buttons { rb1.Checked = false; rb2.Checked = false; rb3.Checked = false; rb4.Checked = false; } void checkAnswer(RadioButton rb)//this function checks if the radio button parameter had been checked or not { if (rb.Checked == true) { //function for the correct answer correctAnswer(); } else { //function for the wrong answer wrongAnswer(); } } void loadQuestion(int unit, int lesson, int question) { //lesson = 3; //question = 4; uncheckButtons(); if (unit == 1)//this function will load the next question depending on the unit number, the lesson selected, and what question it is. { if (lesson == 1)//UNIT 1 LESSON 1 { if (question == 1)//UNIT 1 LESSON 1 QUESTION 1 { pbImage.Image = null; lblDialogue.Text = "What will you NOT be learning in Computer Science?"; rb1.Text = "Basic programming with C#, HTML"; rb2.Text = "How to build a computer";//Correct rb3.Text = "Ethical use of computers"; rb4.Text = "Problem solving, practical applications of computers in society."; } else if (question == 2)//UNIT 1 LESSON 1 QUESTION 2 { pbImage.Image = null; lblDialogue.Text = "One of the following is not a programming language"; rb1.Text = "C#"; rb2.Text = "F#"; rb3.Text = "Microsoft Word";//Correct rb4.Text = "Java"; } else if (question == 3)//UNIT 1 LESSON 1 QUESTION 3 { pbImage.Image = null; lblDialogue.Text = "How much of your course mark is your final project worth?"; rb1.Text = "15%";//Correct rb2.Text = "100%"; rb3.Text = "30%"; rb4.Text = "5%"; } else if (question == 4)//UNIT 1 LESSON 1 QUESTION 4 { pbImage.Image = null; lblDialogue.Text = "What is your teacher's name?"; rb1.Text = "Mr. Goodwin"; rb2.Text = "Mr. Krnic";//Correct rb3.Text = "Mr. Hajatri"; rb4.Text = "Mr. Cacarovski"; } else if (question == 5)//UNIT 1 LESSON 1 QUESTION 5 { pbImage.Image = null; lblDialogue.Text = "Are you going to do well in this course?"; rb1.Text = "Yes";//Correct rb2.Text = "No"; rb3.Text = "No"; rb4.Text = "No"; } } else if (lesson == 2)//UNIT 1 LESSON 2 { if (question == 1)//UNIT 1 LESSON 2 QUESTION 1 { pbImage.Image = null; lblDialogue.Text = "What is code?"; rb1.Text = "A secret message sent from one computer to another"; rb2.Text = "A set of instructions that tell a computer what to do";//Correct rb3.Text = "Numbers"; rb4.Text = "The components inside the computer"; } else if (question == 2)//UNIT 1 LESSON 2 QUESTION 2 { pbImage.Image = null; lblDialogue.Text = "What is the difference between markup and programming languages?"; rb1.Text = "Programming determines how something looks, \nmarkup determines how it behaves"; rb2.Text = "They are the same"; rb3.Text = "Markup determines how something looks, \nprogramming determines how it behaves";//Correct rb4.Text = "A programming language is for robots, \nmarkup languages are for computers."; } else if (question == 3)//UNIT 1 LESSON 2 QUESTION 3 { pbImage.Image = null; lblDialogue.Text = "What HTML tag will insert a horizontal line?"; rb1.Text = "