Wednesday, January 28, 2015

Wednesday, January 28th

Normal class today. Nothing special, except that a couple of people (freshmen) were missing since they were on a class trip with Mr. Panna I think, so they missed class.

I worked well and consistently, on strings. I'm finding that I'm struggling more and more with these string problems ! I am approaching the end of String 1 though, so it's no surprise that they are getting harder as I progress.

There was one problem today where I was sure of my logic, yet it just wouldn't return as I wanted it to. This is the problem I will be showing today. I showed it to Mr. Daly, and together we spent a good 10 minutes ripping our hair out over this problem; we couldn't find what was wrong with it. In the end, it turned out that it was the smallest thing: instead of using 2 equals signs, I needed to use the string.equals(). That's it, all I needed to do and after, the machine returned all correct.
I find that they can be very frustrating, but in the end, that's how I learn and correct my mistakes.

This is the problem below:

Given two strings, append them together (known as "concatenation") and return the result. However, if the concatenation creates a double-char, then omit one of the chars, so "abc" and "cat" yields "abcat".

conCat("abc", "cat") → "abcat"
conCat("dog", "cat") → "dogcat"
conCat("abc", "") → "abc"





I am near the end of String 1, and then I will be moving on to finishing Array 1, which I already started but kind of stopped temporarily to finish String first.


Hockey marathon this Friday ! Next class on Tuesday.






No comments:

Post a Comment