# #WSQ06

--Originally published at Jsph&#039;s Blog

Hey guys!

This was my first try using objects in Java and it was a little tricky.

I saw some post of my classmates and it’s codes to understand more about this but I got some trouble and I can’t run my program

Here’s the screenshot:

Elige entre las etiquetas más utilizadas

# WSQ06 – Greatest Common Divisor

--Originally published at Alan TC201

In this assignment I was rquired to write a program that calculates the greatest common denominator of two positive integers using Euclid’s algorithm.

If you do not know what Euclid’s algorithm is, here’s a page that explains it. http://www.cut-the-knot.org/blue/Euclid.shtml

This is “officially” the second homework and I am still fresh with this of program in Java, this may be easy because I did the same WSQ in the last semester in python. The trick here should be to implement this with message calls, not a simple iterative solution. This must be more oriented programing and nothing like “Python style”, now it is time for JAVA to shine:

This is my second language I am learning and the first object oriented, and I gotta say it is very different, python is very stylish and easy to understand the basics in less than 20 minutes. But Java is different…. very…. very different, just to do a hello world was very weird. This is a new experiences and I hope I can suprius it like in the last semester. The new thing I use in this WSQ was the “input” to give the machine the numbers to fiend the GCD. Video of how to do it. (https://www.youtube.com/watch?v=D3AYFeLjJmU)

And here is the github: https://github.com/alanoswalt/GCD/blob/master/redme.java

# GDC reflective post

--Originally published at richardctc201

Here is the very first coding activity of this semester (except for the HelloWorld activity), and is a program that outputs the greatest common divisor of two given numbers. The challenge of this assignment was to create the most objected-oriented code as possible. So that instead of doing a simple iterative solution, one number (defined as an object) would receive a message to give the greatest common divisor of it and another number passed as parameter.

In order to accomplish the task, I asked for help to a friend of my mom (she works at IBM and knows plenty of coding nerds). Her friend is teacher in ITESO, and he assigned me one of his best students to help with Java, his name is Alex Ramirez. I met Alex one Saturday morning, and he taught me a lot of basic stuff of Java.

The way we addressed this problem was basing our thoughts in Euclid’s algorithm. I created a main class, and another public class call ‘Number’. In Number, I created two different methods: the first was a void type named ‘setValue’, to assign a value to both of my objects; and another void type called ‘max’, this was the important method where all of the math operations were going to be made. In my main class, I created two objects, val1 and val2, and by using setValue, I assigned a quantity value to both objects (in this case 1160 and 2013 respectively). With my two objects, I called the method max in val1 passing as parameter val2. In max, I declared 3 variables: a (val1), b (parameter), c (remainder of a/b)… And thathaa… When running the code, the output was 29, and I had a big smile drawn in my face.

Later in class, my teammate Dustin (alias Finn) helped me with the synchronization of Eclipse and GitHub showing me an excellent video that clearly explain the steps to follow to achieve the synchro.  As you can see, I’m very good at getting help of others!

Here a I leave some screens of my code in GitHub:

# Euclid’s Choice

--Originally published at Ce qui est chouette

Instead of choosing between his two offsprings [as Sophie], Euclid didn’t have  a a choice, like, at all; this was a bad attempt at making Euclid’s Method fun. I’m not saying that it ain’t so, just that…well…you get it, it’s hard, making math fun when it doesn’t have a cool name.

On with the WSQ.

Here’s the code for the “playground” -because classes play there and stuff -and the console output.

Demonstration, at least, of some grasp of OOP and abstraction -because of the perspective.

Now, the class SuNumber:

Some encapsulation knowledge. On with some theory: encapsulation is the process through which information regarding a class is kept “hidden” -unusable outside of the class itself. It is represented in Java through the use of the words “private” or “public” in the object’s attributes or methods.

Ending the least fun of the blog posts. Euclidean method git got from the guy at Cut the Knot

-Me.

# Greates Common Divisor

--Originally published at TC201 Winter 2016 Jorge

Here's my code for the GCD. At first, I wasn't really sure how to implement the object-oriented stuff into the code but then I had a look to some of my classmates from that had this wsq already done and that helped me. Specially Itzel's since I think it's pretty readable and understandable. So special thanks to her!

Now it's my turn to help somebody else, so if you're no sure how to do this wsq, check out my code!

# WSQ06

--Originally published at Programación Orientada a Objetos

Hola!

Con este ejercicio, batalle un poco ya que al principio hice todo el programa sin objetos, lo cual no es el objetivo de la clase, entonces cambie mi código para hacerlo orientado a objetos y que funcionara igual. Creo que lo logré!! :D

Tuve que cambiarle muchas cosas, ya que mi código tenía un error que hacía que entrara a un loop infinito.  Con la ayuda de un amigo, pude terminar mi código, y aquí esta :) :

# WSQ06 – Greatest Common Divisor

--Originally published at GilbertoRogel

For this WSQ i had to find the greatest common divisor of two numbers using Euclid's algorithm.

I had no idea what Euclid's algorithm was so I did a little research and found this useful video that helped me make the code: Click to watch