- the backup talk
- user accounts
- meet the computers
You decide. Read We Are Typists First, Programmers Second. Test your code typing speed

Learn to type at
Ms. Wear will teach a lesson that covers these questions. Answer them as the lesson is taught.

Answer the questions in a Google document
  1. Define software.
  2. What is another word for program?
  3. Why was binary a bad way for humans to enter data into a computer?
  4. What was the first improvement on binary?
  5. What was the first high-level language?
  6. List other high-level languages.
  7. Is Java a high level or low level language?
  8. All running programs are stored in ______________.
  9. What is an operating system?
  10. List 3 categories of software and an example of each.
  11. List examples of operating systems.
  12. How do operating systems decide how to prioritize resources?
Watch Operating Systems As Fast As Possible. Slides.
Follow the steps below to compile and run your first Java program.
  • Watch What is Java?
  • Read Hello World.
  • Read and Do: Create your first application
  • Read: A more in-depth explanation of HelloWorld
  • In class demo:
  • Hello World in Java using Notepad++
  • A quick review of output, integers, doubles, and if statements.
    Programming with Eclipse Resources for Installing Eclipse at Home
    If you have trouble running Eclipse at home, you may try another lightweight IDE like IntelliJ, Dr Java, or jedit.
    Use the Scanner class to get input from the keyboard.
                     import java.util.Scanner;
    Create an instance of the scanner class:
                     Scanner in = new Scanner(;
    To get integer data:
                     int x = in.nextInt();
    To get numbers with decimals:
                     double y = in.nextDouble();
    Additional methods can be found at the Scanner API

    Watch Using the Scanner Class
    1. Define the problem.
    2. Understand the problem.
    3. Formulate a solution (flow chart or a list of steps)
    4. What classes do I need to import?
    5. What variables do I need?
    6. Write the program.
    7. Test the program.
    1. Create a new program that asks the user for a mark on a test using the Scanner class. It should support decimal values since sometimes half marks are given. This should be a double.
    2. It then asks the user for the total marks possible on the test using the Scanner class. This should be an int.
    3. Finally it will display the score as a percent in the console.
    Sample Input
    Sample Output
    1. Create a new program that asks the user for 3 numbers. It should support decimal values. These should be doubles.
    2. It will then display the average of the three numbers in the console.
    Sample Input
    Sample Output

    String Processing is using a program to analyze the properties of a string. String processing is used extensively in programming. For example, whenever you do a Google search, the string you enter into the search field must be processed to produce the search results.

    The Java API is the online documentation for all Java classes. As a Java programmer, it is imperative you learn to use the API. In this exercise you will use the String API to process a string entered by the user.

    Read the following:
    1. Read Java For Students Strings Tutorial
    2. Scroll to "Method Summary" in the String API to see a list of all methods you can use to process Strings.
    3. To see an example of how to use each String method, read Using String Methods with Examples. Click on the name of the string method to see an example of how to use it.

    Create a program that uses the console to ask the user to enter a favourite quote. Analyze the quote as described below. For each item in the list you will need to use one string processing method from the String API. It is your job to read the API and determine which is the best method for the job. All output must be in the console using System.out.println().

    1. Print the letter that appears at index 10. Note: If the quote has less than 10 characters this will throw an exception.
    2. Print the index of the first occurrence of the letter t.
    3. Print the number of characters in the quote.
    4. Replace every occurrence of the word "the" with "foobar". Print the new quote.
    5. Convert the entire string to all caps. Print the new string.
    6. If the quote contains the word "horse", print "I like your taste". Hint: You will need an if statement.
    There are 10 kinds of people in the world, those that understand binary and those that don't.
    Watch in class: Transistors - Why Computers Use Binary

    Use this website What's a Byte? to answer these questions in your Google Docs document:
    1. What is a bit?
    2. What is a byte?
    3. What is a kilobyte? Megabyte? Gigabyte? Terabyte? Petabyte?
    4. Approximately how many kilobytes are in a Terabyte? Megabytes in a Gigabyte? etc.
    Use these tutorials to answer the following questions:
    1) Read Variables Tutorial.
    2) Read Variable Types Tutorial.
    3) Read Character Tutorial (You'll need the ASCII Table).
    4) Read Odd's n' Sods.

    In a Google Docs document:

    I. Complete this table:

    Data TypeSizeMinimum ValueMax ValueSample Values

    II. Answer these questions:

    1. What is the relationship between the size of an integer data type and it's minimum and maximum values?
    2. Can a variable name begin with a number?
    3. Can a variable name have a space in it? a $? a _?
    4. This style of naming a variable: firstNumber, where the second word has a capital letter, is called _________________.
    5. If a variable is not named with the notation described in question 4, will the program compile?
    6. List all the variable types considered to be integer types (there are 5)?
    7. List all the variable types considered to be floating types (there are 2)?
    8. Define: scope.
    9. When assigning a variable with type char a value, what symbols must go around the value?
    10. What is the output of the following code?
      System.out.println("The Answer to the Ultimate Question of Life, the Universe, and Everything is " + 21 + 21);
    11. What is the output of the following code?
      System.out.println("The Answer to the Ultimate Question of Life, the Universe, and Everything is " + (21 + 21));
    12. Why is there a difference between the output of the above two code segments?
    13. How do you make a single line comment?
    14. How do you make a multi-line comment?
    Lesson on:
  • static methods
  • Math API
    • Download
    • Examine and run the code.
    • Use the Math API to complete this task.
    • Calculate sin and cos of the same number as tan
    • Calculate min of the same numbers as max
    • Calculate round of the same number as square root. Find the rounded value of the number entered by the user, not the rounded value of the square root.
    1. Lecture: Von Neumann Architecture
    2. See and discuss: Case, Power Supply, RAM, HDD, SSD, CPU, motherboard, Graphics/Audio/Network Expansion Cards vs Onboard, Optical Disk Drive (CD/DVD).
    In your online notes, explain the purpose of each of the following, and include an image of each:
    1. Case,
    2. Power Supply,
    3. RAM,
    4. HDD, SSD,
    5. CPU,
    6. motherboard,
    7. Graphics/Audio/Network Expansion Cards (explain the pros and cons of Expansion Cards vs Onboard),
    8. Optical Disk Drive (CD/DVD).
    Resource: parts of hardware. This material will be quizzed on.

    Use Wikipedia's Computer Storage to complete the following table:

    Explanation: Hierarchy (primary, secondary, tertiary, offline), Volatility (non-volatile, or volatile), Mutability (r/w, read only, slow write/fast read), Accessibility (random or sequential), Type (semi-conductor, magnetic, optical, paper)

    Storage TechnologyDefinitionHierarchy
    (primary, secondary, tertiary, offline)
    (non-volatile, or volatile)
    (r/w, read only, slow write/fast read)
    (random or sequential)
    (semi-conductor, magnetic, optical, paper)
    Solid State Drives
    Hard Drives
    USB Sticks
    Remember to bring a Philips screw driver on BLOCK B: TUESDAY and BLOCK D: FRIDAY

    Hardware Lab

    Dialog boxes for input and output, try..catch, strings. Program along with Ms. Wear.

    Advanced topic: There are different types of input dialog boxes in JOptionPane. See this JOptionPane Tutorial for more information.

    Replace console interaction with dialog boxes:
    1. Write an application that asks the user for a mark on a test using an input dialog box. It should support decimal values since sometimes half marks are given.
    2. It then asks the user for the total marks possible on the test in a second input dialog box. This should be an int.
    3. If the user enters non-numerical data, catch the exception, display an error, and shut the program down.
    4. Finally it will display the score as a percent in a message dialog box.
    Improve In Class Exercise 3 so that if the user clicks "Cancel" on a dialog box, the program shuts down cleanly.

    You will need the code below:
            String input;  // user input always comes in as string data
            // get user input
            input = JOptionPane.showInputDialog("Enter stuff!");
            // if the user clicks cancel, input will be null, then exit the program
            if (input == null) {
                System.out.println("You clicked cancel");
  • Watch Introduction to Methods

  • Write two methods: getIntFromUser() and getDoubleFromUser() that use JOptionPane dialog boxes and try catch statements. Program along with Ms. Wear.

    Make your code more readable: Redo In Class Exercise 3 with getIntFromUser() and getDoubleFromUser() to make an easier to read program.
    1. Create a new file.
    2. Open an existing program (that works) and copy the 2 lines of code that contain the class header and the main header.
    3. Add the appropriate closing curly braces }
    4. Rename the class.
    5. Save the file as and remember it is case sensitive.
    6. If needed, write all the steps of the program as comments.
    7. Import javax.swing.* if you need dialog boxes.
    8. Copy and paste getIntFromUser() and getDoubleFromUser into the program if you needed.
    9. Start coding.
    In class lesson:
    1. Watch Binary and Base Systems As Fast As Possible
    2. In class lesson on Binary, Hexadecimal and Decimal and how to count. Intro to Binary, Intro to Hex
    3. In class lesson on conversion between all three systems.
    4. In class lesson on binary addition. Binary Addition
    5. Practice:
    6. Play Binary Bonanza. Decimal to Binary practice or play Attack of the Hexadecimal. Hex to Binary Practice
    In class notes
    • Arithmetic Operators (+, -, *, /, %),
    • Simple Precedence (BEDMAS, left to right),
    • Special Case for Division: Casting and Integer Division.
    1. Do this with a partner.
    2. Read this code
    3. Assume the user enters 10 for the first number and 7 for the second number. Write your predictions for the program output on a sheet of paper. Use your notes and the materials below to make your predictions.
    4. When you are done, compile and run the code.
    5. Compare your predictions to the actual output.
    6. If any of your predictions are incorrect, figure out why or ask.
    Support Materials:
    1. Arithmetic Operators
    2. Integer Division, Casting and Modulus
    In class notes
    • Compound Operators,
    • Increment and Decrement,
    • Pre/Post.
    • Precedence

    Sample code: How to Count the Number of Digits in an Integer

    int num = 654321;
    int temp = num;
    int numDigits = 0;
    do { 
        temp /= 10;
    } while (temp > 0);
    System.out.println("There are " + numDigits + " digits in " + num);
    Activity - predict the output on paper, then run code to check results
    1. What is the output of this code segment?
    int i = 1;
    int j = 2;
    int k = 3;
    int m = 4;
    i += j + k;
    j *= k = m + 5;
    k -= m /= j * 2;
    2. What is the output of this code segment?
    int a = 1;
    int b = 2;
    int c = 3;
    System.out.println(++a * b - c--);
    3. What is the output of this code segment?
    int a = 1;
    int b = 2;
    int c = 3;
    int d = 4;
    System.out.println(++b / c + a * d++);
    Support Materials:
    1. Compound Operators
    2. Pre/Post Increment
    3. Pre/Post Increment and Decrement in more detail
    4. Precedence
    Class Discussion
    • How integers and floating point values are stored
    In Class Exercise: Round Off Error
    1. Run this program.
    2. Repeat the mathematical calculations done by the program on paper. What value do you get on paper? Does the program give the same answer?
    3. Using the links and diagram below, formulate an answer as to why the values different.
    4. Try writing a solution to the problem so the program agrees with your calculated answer.

    In your notes, summarize what Round off Error is, why it exists and how to deal with it.

    In Class Exercise: Integer Overflow
    1. Download and run
    2. Use the increment operator (++) to add one to the variables largestByte, largestShort, largestInteger, and largestLong after printing the values of each (around line 26)
    3. Immediately after increasing the value of each by one, print the values of each again.
    4. What are the new values?
    5. Using the links and diagram below, formulate an answer as to why the values are what they are.

    In your notes, summarize what Integer Overflow is, why it exists and how to deal with it.

    1. Data Types: char
    2. Typecasting Primitive Data Types
    Do this Pairs Programming exercise (two people, one computer)
    1. Examine the Ascii Table. This shows the numerical representation of each character. For example, 'N' is stored as 78.
    2. Copy and paste the code below into Notepad++ and name it, Read the program comments and make the required modifications.
              char c1 = 'A';
              System.out.println("The character " + c1 + " is stored as int " + (int)c1);
              // add additional code that also prints the integer values for 'a', 'z', '!', '0', '9', and '@'
              // compare these integer values to the ascii table
              // Explain the output of the following code
              // Explain the output of the following code
              int x = 1200;
              System.out.println(x + " " + (x+1) + " " + (x+2) + " " + (x+3));
              System.out.println((char)x + " " + (char)(x+1) + " " + (char)(x+2) + " " + (char)(x+3));
              // Copy and paste the above code, but change the value of x to 0, 100, 200, 300, 400, 500, 600, etc
              // How high can x go before you start getting invalid characters?
    Discuss Variable Scope.
    Variable Scope Tutorial
    a) PowersCalculator
    1. Download
    2. Examine and run the code.
    3. Add three more METHODs: powerOfThree(), powerOfFour(), and powerOfFive().
    4. Add code to main so that the message window displays the number to the power of 2, 3,4 and 5.
    b) PlayDice
    1. Download
    2. Examine and run the code.
    3. Modify the program so that it rolls three dice and asks the user to guess their total before they are rolled. Tell the user if their guess (between 3 and 18) is correct or not.
    c) CalcAverage
    1. Use this incomplete template to write a method called average() that accepts four numbers and returns the average of those numbers.
    Taught in class.
    if, if..else, boolean expressions, <, >, <=, >=, ==, !=, and, ||, !
    1. Read this Iffy Programming Tutorial
    2. Read this Or else... Tutorial
    3. Read this Boolean Expressions Tutorial
    4. Read True or False?
    Extra Reading:

    In class challenge:

    Get a partner. Try these exercises for a prize!

    Boolean Expressions Exercises

    1. Read this article about Boolean Methods
    2. Write a method called isLeap() that has one formal parameter: the year, and returns true if it is a leap year, otherwise it returns false.
    3. Only use if...else statements, do not use the ternary operator.
    4. Write a test driver to your method for a number of valid leap years, valid non-leap years and extreme cases like -1, 0 and Integer.MAX_VALUE.
    5. The rules to determine if a year is a Leap Year are:
      1. A year divisible by 4 is a leap year (2004, 2008...), unless
      2. it is also divisible by 100 (2100, 2200...) in which case it is not a leap year.
      3. There is an exception. A year divisible by 400 is a leap year (2000, 2400...).
    6. Carefully consider the order in which the above checks should be done to write a simple, accurate, algorithm

    A test driver is a main method that tests your method isLeap() with a variety of inputs to ensure it works. A sample test driver might look like this:

    			System.out.println("2000 is a leap year: " + isLeap(2000));
    			System.out.println("2001 is a leap year: " + isLeap(2001));
    			System.out.println("2002 is a leap year: " + isLeap(2002));
    			System.out.println("2003 is a leap year: " + isLeap(2003));
    			System.out.println("2004 is a leap year: " + isLeap(2004));
    			System.out.println("1800 a leap year: " + isLeap(1800));
    			System.out.println("-1 is a leap year: " + isLeap(-1));
    			System.out.println(Integer.MAX_VALUE + " is a leap year: " + isLeap(Integer.MAX_VALUE));
    			System.out.println("1800 a leap year: " + isLeap(1800));

    Write a test driver that proves your method isLeap() works.

    Read this website about the ?: operator, a shorter version of the if statement.
  • Read about the ?: operator.
  • Write a program that asks the user to input a number in an input dialog box. Print "EVEN" in a dialog box if the number is even, print "ODD" in a dialog box if the number. Check whether number is even or odd using Ternary operator ?:. do not use any if statements
  • switch statement for integers, and enumerated types like Strings, fall through, and using fall through to achieve > or

    1. Read this Switch Statement Tutorial
    2. Write a method called getMaxDays(int m) that has one parameter m which is the numerical value of the month (Jan = 1, ..., Dec = 12)
    3. Use a switch statement to return the number of days in the month (Jan has 31, Feb has 28, ..., Dec 31)
    4. If the month is not between 1 and 12, return -1. Note: -1 is an invalid number of days and indicates to the calling method that the input was invalid. It is the job of the calling method, not getMaxDays to ensure the input is valid.
    5. Write a test driver to test your method for all 12 months and extreme values such as -1, 0, and 13.
    Using Do..While Loops, Try..catch and break and continue for the ultimate user friendly experience.
    In this exercise, you will write methods with the purpose to get input from the user, or to display output to the user. These are called Input/Output methods. This exercise also teaches Overloading Methods, when more than one method has the same name, but has different parameters.
    1. Write a method called getYearFromUser()
      • it asks the user for the year and returns the value of the year if it is valid.
      • This method has no parameters
      • If the user does not enter a positive integer, the method should repeat the question until valid input is gathered.
      • It should return an int.
    2. Write an overloaded method called showResult().
      • The first version of showResult(int num, boolean useDialog) displays num in a message dialog box if useDialog is true and in the console if useDialog is false.
      • The second version of showResult(String message, int num, boolean useDialog) displays just the message followed by num in a message dialog box if useDialog is true and in the console if useDialog is false.
    3. Use this test driver to test your methods:
                            int num = getYearFromUser();
                            showResult(num, true);
                            showResult(num, false);
                            showResult("The year entered was ", num, true);
                            showResult("The year entered was ", num, false); 
    Use these videos, or Google, to research and answer the questions below.
    1. Difference Between Viruses, Worms, Malware, Trojans, Ransomware, and Spyware
    2. Modern Malware Practical Demonstration
    3. Botnets Explained
    4. DDos Attacks
    5. 5 Worst Viruses Ever
    6. Protect Your Computer from Malware
    7. How to tell if your Windows computer has been hacked
    8. Hijacked Computer: What to Do
    Answer these questions in a Google Docs document.
    1. What is malware?
    2. Why do people write malware?
    3. How does malware get on your computer?
    4. What is a virus? What must the user do for a virus infection to occur?
    5. What is a trojan?
    6. What is ransomeware?
    7. What is spyware?
    8. What are worms?
    9. What is the difference between viruses and worms?
    10. Social engineering is an attack that relies heavily on human interaction and often involves tricking people into breaking normal security procedures. How does Social Engineering assist hackers with the distribution of malware?
    11. What is a botnet? Why do people write them?
    12. According to the video shown, what are the five worst viruses?
    13. What can you do to protect your computer from malware?
    14. What command line tool allows you to monitor network communications with your computer?
    15. If your computer gets infected, what should you do?
    Commenting and Formatting: things to remember in all your code:
    1. Include program comments (program name, author, date, purpose).
    2. Include in-code comments.
    3. Leave a blank line before in-code comments
    4. Do not put code inside in-code comments.
    5. Label closing brackets.
    6. Indent 4 spaces after every {.
    7. Put spaces around operators.
    8. Use meaningful variable and method names.
    9. Create all your variables at the top of the method.
    10. No spelling errors in variable names, user interface, or comments.
    11. Follow Java Coding Conventions
    Efficiency and Design
    It's good enough if my program works right?
    Your programming working is the first, and most important, thing to consider. 
    After all, a program that doesn't work is no good to anyone, and worth
    no marks.
    If you assume a program works, then is there more that should be considered?
    These principles of programming should be considered in EVERY program you write and in the following order.
    1) Readability
     Many programs will require modification by you or another coder in the future.  A poorly written program can take more time to read and understand than the actual
     modification. Programs should be written in a way that is easy to comprehend quickly.  This includes the following practices:
       a) define your variables at the top of methods
       b) comment your code
       c) use algorithms that are easy to understand. For example, avoid nested ternary operators.
    2) Reusability
      Avoid duplicating code. Always write reusable methods instead. If a modification needs to be made, it then only has to be made in one location.
    3) Efficiency
      When time permits, write algorithms that minimize the use of RAM and CPU time. For example, if you have nested for loops, does each loop need to 
      run n times, or can the inner loop run fewer times?
    4) Elegance 
      Elegance is very subjective.  However, some things are clear. Read Programming is an Art. 
    Write a program that will read in the number of the day, the month, and the year a person was born.

    For example, someone born on September 3, 1982, would enter the numbers

    3, 9, and 1982.

    into three separate JOP.showInputDialogs.

    If an incorrect value is entered, the program should give a very specific error message explaining why it is invalid and ask the user to enter the information again. A user should never have to reenter more than one of the values when an invalid entry is made (example, if the day is invalid, the user should only have to reenter the day, not the month or the year).

    The program will then tell the person their birthdate with the following format:

    You were born September 3, 1982.

    The format of the date must be as shown above.

    • The program MUST do error checking for invalid months (valid between 1 and 12)
    • The program MUST do error checking for invalid years (valid >= 1800)
    • The program MUST do error checking for invalid day of month (valid between 1 and maxDay in month (30, 31, 28 or 29))
    • The program MUST only allow Feb 29 on LEAP YEARS only
    • Make it Ms Wear Proof.
    • This program is to be handed in with complete commenting on tba. Print out the code.
    • Try the following test cases:
      1. 1 1 2001
      2. 31 9 1945
      3. 29 2 1988
      4. 29 2 1987
      5. 1 24 1934
      6. 29 2 2000
      7. 29 2 2100
      8. 29 2 2400
    • All topics in this unit will be covered
    • 50 multiple choice questions
    • closed everything