## Number Conversions from Base 10

I have written a few posts (Post 1, Post 2, & Post 3) concerning various base number systems. In all of these posts, I covered how to convert from a non-decimal base into a decimal base. In other words, I covered how to get INTO base-10. This post is going to cover the inverse (decimal base into non-decimal base).

#### Modulus

We will need to start by reviewing the concept of modulus division. Let’s look at the standard division problem 5/2. We would typically say that the answer is 2.5 and this would be correct.

Now, modulus is simply the remainder of a division problem. Go back to when you were first introduced to division. In Texas, this is typically in 4th grade. Let’s take a look at that division problem of 5/2 again. When you were learning division, you would have said the answer was 2r1. The 1 is the modulus. When we’re writing the problem to just solve modulus, we would write it as 5%2.

#### Mechanics

##### Decimal to Octal

Let’s say that we have the decimal number (base 10) 4,814 and we want to convert it to an octal (base 8).

We will be building the number from right-to-left. The first thing we will do is solve 4,814/8. This equals 601r6. So, our first digit of the solution (starting on the right) is 6.

`6`

Now, we solve 601/8, which equals 75r1. So, our second digit of the solution (floating from right-to-left) is 1.

`16`

Now, we solve 75/8, which equals 9r3. So, our third digit of the solution (floating from right-to-left) is 3.

`316`

Now, we solve 9/8, which equals 1r1. So, out fourth digit of the solution (floating from right-to-left) is 1.

`1316`

Finally, we solve 1/8, which equals 0r1. So, our fifth and final digit of the solution (floating from right-to-left) is 1.

`11316`

So, the decimal number (base 10) 4,814 is equal to the octal (base 8) 11316.

As you can see, this is a bit of a process, but once you know the process, it is very simple. I now want to take a look at going to number systems with more digits than base 10, for example: base 16.

Let’s say that we have the decimal number (base 10) 4,814 and we want to convert it to a HEX (base 16).

We start by solving 4,814/16, which gives us 300r14. Remember, that is number systems with more than 10 digits, we start using letters.

10 = A
11 = B
12 = C
13 = D
14 = E
15 = F

So, the first digit of our solution (building from right-to-left) is E.

`E`

Now, we solve 300/16, which gives us 18r12. So, the second digit of our solutions (building from right-to-left) is C.

`CE`

Now, we solve 18/16, which gives us 1r2. So, the third digit of our solution (building from right-to-left) is 2.

`2CE`

Finally, we solve 1/16, which gives us 0r1. So, the fourth digit of our solution (building from right-to-left) is 1.

`12CE`

So, the decimal number (base 10) 4,814 is equal to the hexadecimal (base 16) 12CE.

## CS2 10-Jan-2018

Stacks vs Arrays

#### TEKS – §126.34 (Computer Science 2):

• c.3 – Research and information fluency. The student locates, analyzes, processes, and organizes data. The student is expected to:
• c.3.D – manipulate data structures using string processing;
• c.3.F – identify and use the structured data type of one-dimensional arrays to traverse, search, modify, insert, and delete data;

#### Lesson Objectives:

1. The student will be able to create and manipulate a stack data structure.
2. The student will be able to create and manipulate a 1-d array structure.

#### Materials Needed:

1. NetBeans
2. stackedData.dat File (queued phone calls)
3. arrayData.dat File (numbered list)

#### Description of Lesson:

Students will create a basic stack of 10 queued phone calls and pull the top item off of the stack. Discussion will focus on the fact that items are read from top to bottom from the data file. As such, items at the bottom of the file are the last ones placed into the stack.

```import java.io.*;
import java.util.*;

public static void main(String[] args) throws IOException{
Scanner numbers = new Scanner( new File("stackedData.dat")); //Accesses the data file.
Stack firstStack = new Stack(); //Constructor to build an empty stack called "firstStack".
while(numbers.hasNextLine()){ //Opening loop that run as long as the file has a nextLine.
firstStack.push(numbers.nextLine()); //Loop executes a push to enter the data from the data file to the stack.
} //Closes the while loop.
System.out.println("Next Call in Queue is " + firstStack.pop()); //Outputs the item on the top of the stack. Item is removed.
}
}```

Students will then create a 1-D array of a set of numbers. They will manipulate that data set as well.

```import java.io.*;
import java.util.*;
import java.util.Arrays;

public class billy {
public static void main(String[] args) throws IOException{
Scanner nmbrs = new Scanner( new File("arrayData.dat"));
int[] myNewArray = new int[10];
int indexNumber = 0;
while (nmbrs.hasNext()){
int numberFromFile = nmbrs.nextInt();
myNewArray[indexNumber] = numberFromFile;
indexNumber++;
}
System.out.println("Unsorted: " + Arrays.toString(myNewArray));
Arrays.sort(myNewArray);
System.out.println("Sorted: " + Arrays.toString(myNewArray));
int subtr = myNewArray[9] - myNewArray[8];
System.out.println(myNewArray[9] + " - " + myNewArray[8] + " = " + subtr);
}
}```

• Daily Grade – Stack (50%) / Array (50%)

## STEAM: Wisdom from the Front Lines

Today, I had the opportunity to attend a professional development entitled STEAM: Wisdom from the Front Lines that was held at Brookhaven College and coordinated by Education Service Center: Region 10.

The training brought together, in a single room, STEAM educators from secondary and higher ed in an Ed Camp formatted one-day conference. While K-12 and higher ed coordinate with each other at the higher levels, they rarely coordinate at the local level. Today was a first for many of us.

We got to hear what higher ed would like in our graduates and they gave us ideas on projects and programs that we could implement to get them there. It was very insightful and helpful.

On a selfish note, I have recruited an additional team to our robotics league from Faith Family Academy in Waxahachie!

## Computer Science 2 S&S

At the conclusion of last school year, I had a curve-ball thrown at me concerning my plans to offer AP Computer Science 2 based upon an adopted AP syllabus when I requested the course authorization. This course would align with the AP Computer Science – A Exam. In addition, the course would count as a Language Other Than English (LOTE) credit for our students.

Well, the State of Texas had other plans on that. According to TEA, Computer Science 2 can count as an AP credit OR a LOTE credit, but NOT both.

As we already have HB-5 students in progress that need CS2 as their second LOTE credit, we have elected to drop the AP designation. However, I am still modeling the course after the AP CS2 curriculum from the adopted syllabus, which will allow the students to be prepared to take the AP Computer Science – A Exam at the conclusion of the year, if they would like.

Here is what I am planning to cover in CS2 this year:

• Weeks 1 – 2
• Computer Systems
• Numerical Representations, Limitations of Finite Representations, Number Bases & Conversions, Hardware, and Programming Languages
• Weeks 3 – 4
• Objects & Primitive Data
• Simple Data Types (int, Boolean, double, char), Variable & Constant Declarations, Assignment & Arithmetic Expressions, Console Output, Primitives vs. Objects, Create Objects with Classes, References, JAVA Library Classes (String, Integer, Double, Math, & Scanner), and Random Numbers
• Weeks 5 – 6
• Conditional Programming Statements
• Software Development Process, Control Flow, Boolean Expressions, Laws, Truth Tables, and Conditional Expressions
• Weeks 7 – 9
• Iterative Statements
• Flow of Control, While, For, Infinite, and Nested Loops, and Algorithm Analysis (Running Time and Execution Counts)
• Weeks 10 – 12
• Writing Classes
• Anatomy of Classes (Constructors & Methods, Declarations of Class, Interface, Instance, variable, Method and Parameter), Method Overloading, Method Decomposition, Object Relationships, Pre & Post Conditions, and Data Abstraction & Encapsulation
• Weeks 13 – 15
• Enhancing Classes
• References, Exceptions, Class Design, == vs equals, Object Parameter Passing, Error Handling, Interfaces & Abstract Classes, JAVA Library Classes (Comparable & List Interfaces) and Identifications of Reusable Components from Existing Code Using Classes and Class Libraries
• Weeks 16
• Fall Semester Exam Review
• Week 17
• Fall Semester Exam
• Week 18 – 21
• 1D/2D Arrays & Searching
• 1-Dimensional & 2-Dimensional Arrays (Creation, Insertions, Deletions, Transversals, & Algorithms), Searching Algorithms & Comparison (Sequential & Binary), and Choosing Appropriate Data Representation & Algorithms
• Weeks 22 – 24
• Lists, Array Lists, Selection & Insertion Sorts
• Lists & Array Lists (Creation, Insertions, Deletions, Transversals, & Algorithms), Sorting Algorithms & Comparison (Selection & Insertions, and Choosing Appropriate Data Representation & Algorithms
• Weeks 25 – 27
• Inheritance
• Inheritance (Subclass, Overriding, Hierarchies, Using Class Members, Polymorphism, & Class Hierarchy Design), Interfaces & Abstract Classes, JAVA Library Classes (Object), Reading & Understanding Class Specifications (is-a vs. has-a), Understanding & Implementing a Given Class Hierarchy, Extending a Given Class with Inheritance, and Applying Functional Decomposition.
• Weeks 28 – 30
• Recursion / Merge & QuickSorts
• Recursive (Thinking, Programming, & Sorting), Flow of Recursive Control, Sorting Algorithms (Merge & Quick), and Comparison With Other Sort Options
• Weeks 31 – 33
• AP Practice Exam and Computer Ethics
• Responsible Use of Computer Systems (Reliability, Privacy, Intellectual Property, Legal Issues, & Social/Ethical Ramifications of Computer Use), and AP Practice Exam
• Week 34
• AP Computer Science – A Exam
• Weeks 35 – 36
• RoboCode
• Cooperative Programming, Research, Reading Code, and Comparing Strategies & Algorithms

## Roster First Glance & Gender Inequality

I now have my first glance at my rosters today in Skyward.

Here is how it looks right now:

• 1st Period – Principles of Applied Engineering
• 16 TOTAL (13 Males / 3 Females)
• 5th Period – Principles of Applied Engineering
• 16 TOTAL (16 Males / 0 Females)
• 2A – Computer Science 1
• 15 TOTAL (13 Males / 2 Females)
• 4A – Computer Science 1
• 12 TOTAL (10 Males / 2 Females)
• 2B – Computer Science 2
• 8 TOTAL (8 Males / 0 Females)
• 3A – Robotics 1
• 19 TOTAL (13 Males / 6 Females)
• 3B – Robotics 1
• 20 TOTAL (17 Males / 3 Females)
• 3A – Robotics 2
• 7 TOTAL (6 Males / 1 Female)
• 3B – Robotics 2
• 5 TOTAL (4 Males / 1 Female)

Converting these to percentages, this means that 9.28% of my Principles of Applied Engineering, 14.81% of my Computer Science 1, 23.08% of my Robotics 1, and 16.67% of my Robotics 2 classes are female.

A study from Jensen and Nutt shows 74% of females have interest in engineering technology ahead of entry to junior high. At conclusion of high school that interested drops to 2%.

Considering setting my 2017/2018 professional goal to be to develop a program that encourages more females into STEM.

According to US Dept of Ed 2015 study, 10.4% of males earned an engineering STEM credit compared to 2% of females.

Proposing 3 All-Girls STEM Camps for 2018:

• Camp 1 – Completed 4th / 5th Grade
• Camp 2 – Completed 6th Grade
• Camp 3 – Completed 7th / 8th Grade

The major groups to support would be camps 1 and 2.