Tabs Don’t Mean Spit – at Least in JAVA

You would think I could remember this, but I can’t. Tabs don’t mean spit – at least in JAVA!

My UIL Computer Science team was working on the following question recently:

What is the output of the following code?

a) north
b) northKorea
c) china
d) south
e) There is no output due to an error

String count="Korea";
boolean host=true;
if(count.equalsIgnoreCase("KoReA")) {
    if(host)
      out.print("north");
    else
      out.print("south");
  }
  else
    out.print("china");
    out.print(count);

The answer key shows the correct answer as being “B”. When you compile the program, you find that the answer is in-fact “B”.

We had originally reasoned that the answer would be “A” since the else condition that starts online 11 is never met. We interpreted that lines 12 and 13 would run as part of that else statement.

I have been working with Python programming in my Computer Science 1 class and anyone who has worked with Python knows that tabs are the end-all of everything.

For reference, here is what the program looks like with all of the conditionals enclosed in curly braces and tabs adjusted for readability…

class Main {
  public static void main(String[] args) {
    String count="Korea";
    boolean host=true;
    if(count.equalsIgnoreCase("KoReA")) {
      if(host){
        System.out.print("north");
      }else{
        System.out.print("south");
      }
     }else{
       System.out.print("china");
    }
    System.out.print(count);
  }
}

As you can see below, you get the same solution with the code in this configuration:

It was my mistake for not catching it, but it’s a lesson learned. As you can see, line 14 is NOT part of the else statement that starts on line 11.

Lesson Plans – Week of 2018-04-01

Lesson Plans – Week of 2018-04-01

  • (1 A/B) Principles of Applied Engineering
  • (2A) Computer Science 1
  • (2B) Computer Science 2
  • (3A) Robotics 1 / Robotics 2 / FTC 11242
  • (3B) Robotics 1 / Robotics 2 / FTC 12645
  • (4A) Computer Science 1
  • (5 A/B) Principles of Applied Engineering

Eric Evans – Planboard Week – 2018-04-01

Lesson Plans – Week of 2018-03-25

Lesson Plans – Week of 2018-03-25

  • (1 A/B) Principles of Applied Engineering
  • (2A) Computer Science 1
  • (2B) Computer Science 2
  • (3A) Robotics 1 / Robotics 2 / FTC 11242
  • (3B) Robotics 1 / Robotics 2 / FTC 12645
  • (4A) Computer Science 1
  • (5 A/B) Principles of Applied Engineering

Eric Evans – Planboard Week – 2018-03-25

Lesson Plans – Week of 2018-03-18

Lesson Plans – Week of 2018-03-18

  • (1 A/B) Principles of Applied Engineering
  • (2A) Computer Science 1
  • (2B) Computer Science 2
  • (3A) Robotics 1 / Robotics 2 / FTC 11242
  • (3B) Robotics 1 / Robotics 2 / FTC 12645
  • (4A) Computer Science 1
  • (5 A/B) Principles of Applied Engineering

Eric Evans – Planboard Week – 2018-03-18

Q3 Grade Distribution 2017/2018

Today, we are closing the 3Q grading period for the 2017/2018 school year. I have a total of 134 students with 50 of them enrolled in either Robotics 1 or Robotics 2.

Through my career, I have seen many students slip with their grades during this grading cycle. Regretfully, this trend has not abated much this year.

Robotics 1, Robotics 2, and Computer Science 2 have 100% of students passing. But the more curriculum-based courses have failures.

As you can see, Computer Science 1 has an overall failure rate of 13.33% (4 of 30 students). 75% of those failures come from one class period as a result of failure to complete a major multi-part project involving 2-dimensional arrays in Python.

The vast majority of the class (73%) received an A. The majority of those (63%) came from a single class period.

All-in-all, I am happy with the performance of both sections as we had some difficult concepts to cover during this grading period.

As you can see, Principles of Applied Engineering has an overall failure rate of 4.26% (2 of 47 students). The failures are evenly distributed between both sections of this course.

One section comprised 60% of the A’s, 42% of the B’s and 55% of the C’s. The other section was 40%, 58%, and 45% respectively.

This grading period, we covered mechanical, materials, and electrical engineering. Many students struggled with mechanical engineering and their grades reflected those challenges.