Base 10, 2, & 8 Addition and Subtraction Worksheet

A few weeks ago I covered base-10 (decimal), base-2 (binary), base-8 (octal), and base-16 (hexadecimal) number systems with my UIL Computer Science team. I am now getting to that same concept with my Computer Science I class.

I am starting with the basics of bases 10, 2, and 8 on the first day. We’ll cover what they are and then how to add and subtract numbers within those numbering systems. Of course, for base-10, this should be very easy. However, I realized that covering the mechanics of what actually happens when you add or subtract numbers in base-10 tremendously helps when covering the other numbering systems.

Following this exercise, we’ll add base-16 to the mix and then discuss how to convert between the systems.

The first 25% of the 2016/2017 Academic Year is now in the books! Hard to believe – but, it’s true. This past Friday, 14-October-2016 marked the end of the first 9-week grading quarter of the year.

Here’s a recap of how the grades broke out for my various classes:

Computer Science I (1B)

This quarter ended with an introduction into iterations, which is one of the more challenging concepts for students to comprehend. As such, the grades fluctuated a little bit at the end of the grading cycle.

The only 2 failures were due to poor performance on the unit tests and not taking advantage of the opportunity to submit corrections to bring the grades higher.

Principles of Technology (2A)

The quarter ended with an introduction to Conservation of Energy and Momentum. The only two failures in the class were not a direct result of poor performance on a test, but due to lack of participating on projects.

The only 2 failing students elected to not participate on various major projects during the first quarter (e.g. air skimmer, water bottle rocket, etc…).

Robotics & Automation (3A)

Unlike the previous two classes, all students in this class passed all objectives for the quarter. Any low-grades were once again due to students not submitting work and not due to lack of understanding.

While the graph shows 1 student failing this class during this period, that grade was adjusted up to passing as it was within the 69.0 to 69.9 range. I personally do not let students sit on a “9”. I always override and round up the 69, 79, and 89.

As such, like the 3A Robotics and Automation class, this class had no failures!

Like the BIM class before it, this class had no failures! However, this class genuinely had zero failures and also held the highest average of all of my BIM classes! Way to go BIM 3B!

Like the BIM class before it, this class also genuinely had zero failures and came in a close second for the highest average of my BIM classes! Good work BIM 4A!

Like the BIM class before it, this class also genuinely had zero failures. However, this class had the highest number of low-C’s of any of the BIM classes. I am going to need to watch this class closely as there were far too many students who were too close to falling below the cut-off for my comfort.

What Will Be Changing

As we enter the 2nd Quarter of the year a few things will be changing in all of my classes.

1. Seating chart will be established for Computer Science I to cut down on incidents of students disrupting class and interfering with learning.
2. Seating chart will be established for Principles of Technology to address incidents of student disruptions.
3. Seating chart will be established for Business Information Management (4B) to address student interactions that are preventing work from being completed in a timely manner.
4. Students who fail to complete an assignment will be immediately assigned to come in for lunch/advisory on that day if in 1st or 2nd periods and on the next day if in 3rd or 4th periods.
5. Students will not be allowed to take “breaks” on the computers when working. They will be allowed to listen to music, but video games will be blocked until complete and proper work is submitted.
6. Campus late policy will be implemented as written. Work will no longer be taken after 5 days from assigned date except in rare and extreme cases.

Iterations Exam 1

In Computer Science I, we have now completed our first exam over iterations. This was a high-level look at basic iterative structures such as:

• for loops
• while loops
• nested while loops
• do while loops

The test was administered in a single 90-minute class and then reviewed for corrections which were submitted during the next class session.

The raw (uncurved) exam grades came in with a MEDIAN of 53% and a MEAN of 60.4%. The curved exam grades had a final MEDIAN of 74.05% and a MEAN of 77.8%.

Following validation of the 25 questions, it was determined that only 1 question (#6) was a bad question and was discarded. The remaining 24 questions were considered valid and correct.

Well, here we are – 6 calendar weeks into the 2016/2017 academic year! While we are running 9-week quarter grading cycles, the UIL requires eligibility to be calculated at the first 6-weeks and then at each progress reporting period – approximately every 3 weeks.

Here, you can see that I have a total of 16 students on the roster at the time of the snapshot.

• 8/16 (50%) have A’s
• 3/16 (18.75%) have B’s
• 3/16 (18.75%) have C’s
• 1/16 (6.25%) have F’s

To date, this class has had 1 major grade (25% of average), 3 intermediate grades (25% of average), and 8 minor grades (50% of average).

The next grade check will be at the conclusion of Q1, which ends on Friday, 14-October-2016.

If/Then/Else If Versus Switches

Let’s examine the difference between using If/Then/Else If statements and Switch statements on a basic menu control object.

We are working with the structure of a previously built 4-function calculator that was constructed with If/Then/Else If statements similar to the following:

```//Program Name: 4-Function Calculator
//Programmer Organization: Ferris High School
//Program Date: Fall 2016

import java.util.*;
import java.lang.*;
import java.io.*;

public class calculator{
public static void main (String[] args) throws java.lang.Exception{
System.out.println("Basic Calculator");
System.out.println("2 - Subtraction");
System.out.println("3 - Multiplication");
System.out.println("4 - Division");
System.out.println("");

}else{
//Code if Other Integer Option is Selected
}
}
}```

Let’s compare the structure of the above with that of a Switch statement similar to the following:

```//Program Name: 4-Function Calculator (Switches)
//Programmer Organization: Ferris High School
//Program Date: Fall 2016

import java.util.*;
import java.lang.*;
import java.io.*;

public class calculator_switches{
public static void main (String[] args) throws java.lang.Exception{
System.out.println("Basic Calculator");
System.out.println("2 - Subtraction");
System.out.println("3 - Multiplication");
System.out.println("4 - Division");
System.out.println("");

case 1:
{
break;
}
case 2:
{
break;
}
case 3:
{
break;
}
case 4:
{
break;
}
default:
//Code if Something Different is Entered
break;
}
}
}```

Structurally, they both look about the same. Some of the first observations made are similar to “The Switch code is longer.” or “The Switch code has ‘break’ in it a lot.” or finally “I’m going to be thrown off that I don’t need curly braces in the default case of a Switch.”. All of these are good valid observations and concerns. Now, let’s look at why we even consider using the Switch construct.

Why Do We Care?

The primary reason we care is in the general processing speed of the application. When using an If/Then/Else If statement, the application must process each case until it finds the condition that is met. Once that condition is met, the conditional processing stops.

In contrast, a Switch statement creates a jump table that automatically jumps to the correct segment of code to be executed.

When Should I Use What?

If you have a construct that has two different pathways plus a default escape pathway, then an If/Then/Else If is typically considered the best choice.

Example – If/Then/Else If

```if (menu == 1){
}else{
//Code for Items Other Than Menu Options 1 or 2
}```

However, anything beyond two different pathways plus a default escape pathway is better suited by a Switch statement.

Example – Switch

```switch (menu) {
case 1: {
break;
}
case 2: {
break;
}
case 3: {
break;
}
case 4: {
break;
}
default:
//Code if Something Different is Entered
break;
}```

Which is More Efficient?

This is a bit of a loaded question. Some would say that efficiency is defined by how much typing and therefore “coding” is done on the front-end. In this case, the If/Then/Else If code at the top of this post has 755 typed characters while the Switch code has 787 typed characters. By this definition, the Switch code is 95% as efficient as the If/Then/Else If code.

If we define efficiency as speed at which the application runs, it depends on what data is input into the application at runtime. For example, if in the If/Then/Else If the user enters menu choice 1, the application processing time will likely be equal to or slightly faster than that of a Switch since menu choice 1 was the first condition to be checked.

However, if menu choice 4 is selected in the If/Then/Else If code, the application processing time will be longer than that of the Switch code since the conditional statement of menu choices 1, 2, and 3 had to be checked first since they were above the 4th menu choice in the code.

An If – Then – Else Calculator

Today, in Computer Science, we applied the basics of If-Then/Else-If to build a 4-function calculator.

Students were instructed to create a basic calculator application that would first query the user which function they wanted to compute:

2 – Subtraction
3 – Multiplication
4 – Division

Upon selecting the desired function, the user would be asked to enter the numbers needed to perform the desired calculation. Upon entry of the requested data, the answer would be displayed in plain English.

In the end, the general program looked like the following…

```//Program Name: 4-Function Calculator
//Programmer Name: Eric Evans, M.Ed.
//Programmer Organization: Ferris High School
//Program Date: Fall 2016

import java.util.*;
import java.lang.*;
import java.io.*;

public class calculator{
public static void main (String[] args) throws java.lang.Exception{
System.out.println("Basic Calculator");
System.out.println("2 - Subtraction");
System.out.println("3 - Multiplication");
System.out.println("4 - Division");
System.out.println("");

Scanner firstNumber = new Scanner(System.in);
double firstNum = firstNumber.nextDouble();
Scanner secondNumber = new Scanner(System.in);
double secondNum = secondNumber.nextDouble();
double solution = firstNum + secondNum;
System.out.println(firstNum + " plus " + secondNum + " equals " + solution);
Scanner firstNumber = new Scanner(System.in);
System.out.print("Enter the First Number in Your Subtraction Problem_ ");
double firstNum = firstNumber.nextDouble();
Scanner secondNumber = new Scanner(System.in);
System.out.print("Enter the Second Number in Your Subtraction Problem_ ");
double secondNum = secondNumber.nextDouble();
double solution = firstNum - secondNum;
System.out.println(firstNum + " minus " + secondNum + " equals " + solution);
Scanner firstNumber = new Scanner(System.in);
System.out.print("Enter the First Number in Your Multiplication Problem_ ");
double firstNum = firstNumber.nextDouble();
Scanner secondNumber = new Scanner(System.in);
System.out.print("Enter the Second Number in Your Multiplication Problem_ ");
double secondNum = secondNumber.nextDouble();
double solution = firstNum * secondNum;
System.out.println(firstNum + " times " + secondNum + " equals " + solution);
Scanner firstNumber = new Scanner(System.in);
System.out.print("Enter the Total Number of Items You Wish to Divide_ ");
double firstNum = firstNumber.nextDouble();
Scanner secondNumber = new Scanner(System.in);
System.out.print("Enter the Total Number of Groups You Wish the Items Divided Into_ ");
double secondNum = secondNumber.nextDouble();
double solution = firstNum / secondNum;
System.out.println(firstNum + " divided by " + secondNum + " equals " + solution);
}else{
System.out.println("Make Valid Selection.");
}
}
}```

In the next class session, we’ll discuss using Switches vs. If-Then / Else-If statements and analyze when those are appropriate and when they are not.

It Is a Language Other Than English!

It has been a bit of a day, but we now have official word from Texas Education Agency that Computer Science I, Computer Science II, and Computer Science III are all considered as Languages Other Than English and therefore meet the LOTE requirement for students for high school graduation.

At the time of this writing, much of the information on the TEA website is out-of-date and refers to a September 1, 2016 deadline for when these courses no longer count as a LOTE credit. This was what generated much of the confusion.

For us, this means that this course must remain named Computer Science I and not Computer Programming. The difference is that Computer Science I is funded from the State of Texas Technology Applications / Computer Sciences budget while Computer Programming is funded from the Carl D. Perkins-backed Federal Career & Technical Education budget.

Regardless of funding source, we want to do what is in the best interest of our students and offering them an additional “foreign language” alternative is in their best interest. As such, it’s Computer Science I for this year.

AP or No AP

Introduction

This week, I have had the privilege of working with some outstanding educators from across the country at the UTeach: Computer Science Principles AP training held in Dallas, TX.

At this training, we were preparing for the newest addition by College Board to their general AP offerings: AP Computer Science Principles.

On the first day, the presenter stated that not all schools represented were going to be offering this for AP credit and I was stumped. I could not figure out why you would not present a course as AP if you could. However, as the week went on, I realized that my own campus is likely one of the ones that will not offer it as an AP course.

Background (Course)

This course is built to be offered to students who would not typically take a Computer Science course. UTeach has based their curriculum on the University of Texas courseThriving in Our Digital World which is the mandatory Computer Science course for non-Computer Science majors.

Background (My Students)

The students I will be starting with next year have all self-taught themselves JAVA as part of an after-school club. They participated on their own at UIL district competition and advanced to compete at UIL regional competition! These students have a strong desire to refine their skills in computational thinking and program development.

The Problem

The AP Computer Science Principles course is language agnostic and primarily relies on block languages such as Scratch for its primary delivery. As my students have been working with a text-based language, this will feel like a substantial step backwards.

Also, the course will not adequately prepare my students for participation in UIL, which is JAVA specific. I feel that my students will derive more long-term benefit from preparation and participation in UIL than they would completing this AP course.

I am blessed to have an administration team at the campus and district levels who trusts my judgement to do what is in the best interests of our students. I have actually been told by one of my administrators, “My ego is not stroked based upon how many courses have the letters “AP” in front of them. Do what’s best for our students. That’s what I want and what I expect.”

The Decision

Currently, the decision has been made that we will be offering the following:

• Computer Programming
• 2016/2017 (Not AP)
• Programming Language: JAVA
• 2017/2018 and Beyond (Not AP)
• Programming Language: Python
• AP Computer Programming
• 2017/2018 (AP CS-A)
• Programming Languages: Python, Ruby and Persistent Parallels to JAVA
• 2018/2019 and Beyond (AP CS-A)
• Programming Languages: JAVA and Ruby

The idea is that the students entering Computer Programming in 2016/2017 will be formally learning JAVA. In the next year, those students will progress to the second-year course, which is aligned with AP Computer Science-A and will cover the languages of Python and Ruby with persistent reminders of JAVA. Students in this group will be the UIL Computer Science team for both 2016/2017 and 2017/2018.

The students entering Computer Programming in 2017/2018 will be learning Python while learning computational problem-solving skills. In the next year, those students will progress to the second-year course, which is aligned with AP Computer Science-A and will cover the languages of JAVA and Ruby. Starting in 2018/2019, when these students enter the second-year course, they will be the UIL Computer Science team. In all future years, the team will be comprised of students from this second-year course.

Long-Term Benefit

The hope is that students in this program will leave with truly marketable skills in JAVA, Ruby, and Python development.