APCS Hkis Logo

GitHub:

https://github.com/190276/Logos/blob/master/Potato

 

For today’s challenge, we were asked to take some data on the HKIS logo and turn it into an actual image. The white spaces were indicated by the 255 and the black spaces were indicated by the 0. We had to use 2D arrays in order to complete this assignment.

What I tried doing was creating two loops and an if statement to check which spaces had 255s and 0s. For(int x=0; x<pixels.length; x++) was the first loop. This would show the loop for the rows we had in the pixel array. I used the .length to limit how far my x value could go. This would ensure that it would stop at the last row. For(int i = 0; i < pixels[x].length; i++) was the second loop. Similar to the first loop, this would loop the number of columns we had in the pixel arrays. Due to the fact that the .length would not work with the columns, I had to find another way to detect the number of columns. In order to solve this problem, I used pixels[x].length to find the number of columns. Since I did not just place in any number instead of x, this would work no matter how many columns pixel has.

Next, I needed to check if the value of pixels[x][i] was equal to 255 or 0. I used an if statement to check if the value was 255. If the value was 255, I programmed it so that it would print two spaces (System.out.print(” “); //print two spaces). If the value was not equal to 255, it would print two hashtags (System.out.print(“##”); //print two hashtags) using the else statements.

APCS Decrypt/Encrypt

GitHub:

 

Reflection:

I would say that this was one of my hardest summatives to do for this semester. I was completely unsure at the end of how to decrypt and I slowly worked my way to do it. I had to use numerous references to understand how to convert between datatypes and read presentations on how to use .length(). I believe that the decryption was harder than the encryption for me. This was because numerous times in the decryption I lost my way and had to refer back to my flowchart. I changed strategies numerous times and got a little frustrated sometimes.

Encryption:

First I put in a parameter stating that the user must provide a String for me to encrypt. Then I used a constructor to take that String and put it in one of my variables. Finally, I used a while loop (I will use a for loop later) to slowly turn my String into ASCII code. I used the charAt to take the String and turn it into the char. Then I converted the char into an integer. This would make the original string into a ASCII number. To ensure that this loop is not infinite I finished by adding 1 to my sasuage. The loop stated that as long as the sasuage does not become greater than my fieldBagel, it would keep converting.

With a little help from Angelica I was able to finish the Encryption. Overall I would say that the Encryption is pretty easy but next I wanted to try the Decryption alone.

Github:

 

Decryption:

(This was finished around 8:03)

I started the Decryption at around 7 due to procrastination. At first I was really frustrated because I had no idea what I was doing. I initially wanted to take in the integers as that is what I was left off with. However, this would cause trouble to the user if they didn’t have the ASCII code with them. So I started off with a converted String from the initial ASCII code. The first top part (creating field and constructor) is similar however the bottom part is slightly different. First off I wanted to practice my for loop now so I used that instead. I created a variable x that would keep using the loop until it is greater than my String’s length (character). In order to not get the small String error, I made sure to not include the equal sign in my loop. Then what I did inside the loop is that I converted it into a char and then into an ASCII integer. Since I knew that this code was already encrypted, I had to minus one from the ASCII code to push the letters back up one space.  Then this was the part that I had huge trouble on. I was completely unsure of how to turn the ASCII code back into a string. This required a lot of stack overflow research. Eventually, I came upon something called Character.toString. As the name suggests, this converts the characters to string. So I took my ASCII code, I smashed it back into char by using (char) ascii. Once I used the Character.toString, it magically turned into the original String. Example: I put in cpc and it turned into bob. I would say this is a job well done.

Main Method:

.For my main method, I would say that this is the easiest to do. I created the main method (which I had missed numerous times in the past) and then I put a new object in with a string. Finally, I used my method in the Encryption/Decryption to convert it back to the new/orginal message.

APCS Calculator

 

Reflection:

This challenge allowed me to learn the four basic operations and concatenation in java. The four basic operations are represented in this way: Addition (+),  Subtraction (-), Multiplication (*), and Division (/).

At first I didn’t know how to do the operations. I immediately started planning with how I was going to get the user to choose what operation they wanted. I made them pick a number between 1-4, depending on what operation they want they could choose which number. Addition is 1, Subtraction is 2, Multiplication is 3 and Division is 4. Furthermore I asked them which numbers they wanted, I stored the first number in variable n and the second number in variable o.

Then I could put all the math together. Since I wanted addition I could do (n+0), subtraction would be (n-0), multiplication would be (n*0) and division would be (n/0). Overall I would say that this challenge isn’t too hard for me and I would like to see what I can do in the future.

APCS: Lesson 2

Images:

Reflection:

Today we started learning how to use java in the terminal. We started off explaining some terms: Compiled, Interpreter, Bytecode, Source Code. We used a pizza analogy to explain it in easier terms. First off, there is complied code. Complied code is like having a pizza in a restaurant with no takeaway. The restaurant is really fast at making this pizza, but it cannot be taken out to eat. You must eat the pizza in the restaurant and you cannot modify the pizza. Therefore only one person is allowed to eat that one pizza at the time. Interpreter code is like having a frozen pizza. As such, all you need for frozen pizza is an oven. You can eat the frozen pizza anywhere, as long as you have the oven. The oven is like the interpreter, therefore making the code available to all computers.

Next we learned about how to make the “Hello World!” statement in the computer. We also got a little bit of an introduction to user inputs. At first, terminal looked like a daunting task. Overtime, I began to understand some vocabulary in the terminal language. For example, when you type of ls in the terminal, it LiSts out all the files. Then we began to program the Hello World in the terminal.

  1. Focus on the Desktop

    cd ~/Desktop (cd = Change Directory)

  2. Then you can make a directory on the desktop (folder)

    mkdir HelloWorld (mkdir = MaKe DIRectory) 

  3. Focus on the new directory (folder)

    cd HelloWorld 

  4. Edit the java file

    nano HelloWorld.java (nano = edit text file)

  5. Put in code

    (Hello World Code was inserted for my java protect)

  6. View the java file if needed

    less HelloWorld.java (less = view the file)

  7. Run the code

    java HelloWorld Dad

APCS : Lesson 1

Images:

Blog for 17/8/17 :

Today we started learning how to code in java. Coming into this, I had no experience at all with java. I had previous experience with python, Arduino, and scratch, but I didn’t know what I was getting into with java. First we learned some terms in the java language. For example, we learned about an argument. An argument is the instance passed to the method during runtime.

I was surprised to see that java much harder to learn than python. There are different things you need to look out for in java than in python. For example, I didn’t know that brackets { had much more importance to me when working on my code. When I typed in my first code to print out “Hello World”, I didn’t have a { bracket. Thus making my code unworkable.

Another challenge I had was I didn’t know how to run my code. I tried pressing buttons but to no avail. However, my classmate Kinsey helped me out and eventually I learned how to run the code. In order to run the code, you had to right click the program. Press compile, and only then you can run it.

All in all, I think that this lesson was really enlightening for me. I ran my first code in java, which turned out to be extremely cool for me. Also, I learned about the basics and now I’m really to learn how to input user input.

I2P Final Project

Youtube Advertisement:

Photo:
IMG_4659IMG_4660 (1)

Problem Reflection Photo:
Screen Shot 2017-05-31 at 9.38.22 PM
Screen Shot 2017-05-31 at 9.38.31 PM

Note: Results of questionnaire are in the previous reflection

Reflection:
I think that overall, this was a nice way to end the unit. Claire and I had our troubles and frustrations on working on this project. At first, we had no idea what we wanted to do. We contemplated over doing a locker program or an ID card reader. However, our survey shows that many of the students of HKIS felt that the aircon was broken. It would often be too cold or too hot. Thus, we decided to do a temperature sensor in Arduino.

During the process of making the temperature sensor. We ran into many troubles and sometimes they required assistance from other people. However, in the end, we managed to solve the issue. For example, the lights were not blinking. However, we borrowed some books from the library and also researched it online and found a suitable code for our program.

Also, we managed to get an Imovie that basically advertised our product. It features some comedy and also gives a brief description on how the Arduino works. I think that I took a great deal of time working into the Imovie and it turned out great.

Final Project Survey Answers

Images:
Screen Shot 2017-05-17 at 7.58.13 PM
Screen Shot 2017-05-17 at 7.58.00 PMScreen Shot 2017-05-17 at 7.58.20 PM

Reflection:

From our first questionnaire, we found out that a lot of people had a lot of problems with the aircon and lockers. What we originally wanted to do was to make the bathroom seem more secure and noticeable when people were inside, however, people didn’t really want that. What we decided to do in the end was an aircon solution. Basically, we wanted something that could test how cold/hot it was in the room. If it was past/below the threshold, it would turn on the machine. We would be able to do this with a LED light so it shows that the machine would turn on.

We decided that we would use an Arduino to program it. I don’t really have much experience with Arduino but we were willing to give it a try. We borrowed a book from the library which was really cool because it gave us a step by step tutorial with some codes to try. What we had to do was to make sure that it could be different from our final project as that would be taking someone else’s idea.

Python Lesson 10 – Arduino Reflection

Video:

Reflection:

For the Arduino, I think that it was sometimes really easy, but sometimes really hard. For the first part, I felt that our software was either not correctly downloaded or the wrong version, causing us to waste 30 minutes of time trying to fix it. It was really frustrating for us because we didn’t know what to do. However, once we got it, we finally heaved a sigh of relief. I think Arduino is really fun and a hands-on project, but it also can be really confusing. The labels are quite small, even though we have young eyes I sometimes mixed up where to put the wires in.

The first challenge we did was a LED, we didn’t really know how to do it because we accidentally mixed up our ground and our volt wire location, causing the circuit to have no power. However, with a little bit of help, we managed to fix it and it was really cool watching it blink. I felt like we were watching a Christmas Tree light up :D.

The next challenge we did was blinking multiple LEDs. Because we already gained some understanding from the first one, we managed to do this without any help. It was really cool to seem them blink in order. Also, I understood that we needed to connect it to different ports. So we used 8, 9, and 10. Finally, we used the LED that could blink the colours at the same time. What I noticed about this was we needed to use a new wire to plug it in. Because I couldn’t really see well, I didn’t notice that it had different colours in the LED so I was really confused until I saw the reflection in the table.

Overall, I would say that this is a really fun lesson. The examples, however, were really confusing and I hope to master Arduino next time :D.

Makey Makey with Balance Board Challenge

Video:

Program displaying it’s working is the first video, explanation is the 3rd video.

Image:
Screen Shot 2017-05-02 at 9.01.40 PM
Reflection:
Screen Shot 2017-05-07 at 9.32.12 PM
Screen Shot 2017-05-07 at 9.28.53 PM
Screen Shot 2017-05-07 at 9.32.27 PM

Reflection:

Scratch:
I think that the scratch program was a lot easier to deal with because it gave us set functions. While it may be more limiting, it also allowed us to not have any errors and extra stuff when focusing on our program. I also think that during the time we worked on the scratch was mildly challenging but also mildly interesting.We had some problems, but we always managed to solve it in the end without any frustrations.

Python:
I think that python was the hardest. Installing it to a long time and we didn’t fully understand how to program it. Some things that we found really challenging was the fact that we had to learn new material in such a short time. We didn’t have any experience preparing for it and so when we got to it we had no idea where to start. Therefore, the due date of this got further pushed back. I think that if we had some practice to do this beforehand, we would have finished a lot quicker and with a better product. Of course, if I had the time I’d be willing to clean this up for the UP kids. Making sure there was some background and it was more loveable. However, I did get all the essentials down and this could be the start of something great.

Web resources:
http://stackoverflow.com/questions/7692763/timer-in-python-for-a-game
http://stackoverflow.com/questions/16442923/how-to-insert-an-image-in-python
http://stackoverflow.com/questions/16726354/saving-the-highscore-for-a-python-game

Python Lesson 9 – Makey Makey Balance Board 2

Images/Video:
Screen Shot 2017-04-25 at 11.04.34 AM

Screen Shot 2017-04-25 at 11.04.24 AM

Reflection:

Today we had worked on the scratch part of the balance board. We finally got it to work with many difficulties. For example, we didn’t know why the counter didn’t go up when we wanted to. We found out the answer when we saw that we needed to use when this or this is not a function of scratch. There were some other problems too, however, Mason really helped us out through them. Our timer counts upwards but only in seconds with decimal places. We made sure that when the board hit the ground, it would stop the timer and record it into the highscore, right after their name which they had inputted first.

What we got on our own was to combine the name and the scoreboard into scratch. We made sure that they couldn’t overlap and that we got all the information we needed. Some other things that worked well were the circuit. Because of the practice, we had last class, we were able to quickly set up a circuit that worked whenever we tried it.

Something that I would like to change about our program is the aesthetics, the background was very dull. When I saw the example from Natalia and her partners it had a very nice background image. This is something very easy to change and I’m sure we are able to accomplish it in the new lesson.

If we were to record it to a text file, we would need to make sure that we could input in a text file. I believe that scratch is unable to accomplish this, however, if we were to move to python, I think that this is something we could plan to achieve in the next lesson.