Archive for octubre 2014

viernes, 24 de octubre de 2014
Posted by Unknown

SDP03 Exercise 09

Octubre 24, 2014

El ejercicio 09 fue una continuación del ejercicio anterior.

La estructuras de inserción de datos presentan la sintaxis siguiente:

UNumber two = new UNumber("2", 1, true);

A través de la definición de una variable mediante los argumentos anteriores se cuenta con la información suficiente para poder efectuar el algoritmo y obtener la raíz cuadrada de un valor dado.

Fue necesario recurrir  a una variable para almacenar un conjunto de operaciones de clase UNumber y resolver el problema.

Como resultado obtuvimos los valores de raíz cuadrada del valor indicado como parámetro.
Analizamos que la asignación de valores de una variable a otra debe ser a través de una nueva instancia de la variable para que las operaciones que se realicen sobre una variable no afecten a los otra.
Posted by Unknown

SDP03 Exercise 08

Octubre 24, 2014

Este ejercicio es la base para la continuación del siguiente ejercicio; ambos tratan de encontrar la solución a la raíz cuadrada de un número. 

En esta aplicación fue necesario entender el funcionamiento del procedimiento para calcular la raíz cuadrada a partir de un algoritmo distinto al que empleamos tradicionalmente.

Se declaró un ciclo en el que se van obteniendo números aproximados a la solución, es decir, números que al multiplicarse por sí mismos se acercan cada vez más al número buscado. En esta parte fue importante seguir una serie de operaciones necesarias para el cálculo. 

Fue importante notar que no se aplican los operadores de la misma manera que con valores double, float, byte o int sino que, por pertenecer a la clase UNumber, emplea operandos distintos.  Métodos proporcionados por la clase para efectuar las operaciones.

Algo que impidió en un momento que halláramos la solución fue que la asignación de valores debe darse o llevarse a cabo de manera distinta, además de que declaramos las variables adecuadas para cuantificar los valores.
Posted by Unknown

SDP03 Exercise 07

Octubre 24, 2014

En este ejercicio tomamos como base para el código el ejercicio 06, la diferencia fue que en esta ocasión había que manejar valores de mayor precisión, es decir, valores de la clase UNumber que acompañaba el paquete de clases.

Un error que corregimos desde el inicio fue el nombre del paquete escrito en la clase UNumber, ya que hacía referencia a un paquete no incluido en nuestro proyecto JAVA. 

Agregamos el código del ejercicio anterior declarando las variables mediante constructores UNumber y siguiendo los parámetros adecuados que permitieran el buen funcionamiento del proyecto. Esto fue algo que aprendimos con los distintos proyectos de este módulo; manejar adecuadamente la clase UNumber hecha para tener una mayor precisión en los resultados de operaciones matemáticas y cálculos más complejos.

Declarar las variables inicializadas con los valores correspondientes, ahora con valores pertenecientes a la clase UNumber, la sintaxis es:

UNumber [nombreVariable] = new UNumber(valorInicial);

Durante el proceso de codificación, manejamos el intercambio entre valores String, char, byte e int empleando herramientas de conversión posibles e incluidas en la paquetería JAVA.

Modificamos algunas condiciones IF porque era necesario adecuarlas a las nuevas especificaciones y obtención de valores. 

La ejecución del programa fue exitoso y mostró el resultado esperado.

Posted by Unknown

SDP03 Exercise 06

October 24th, 2014

In this exercise we had to add some code lines in order to make the application to show to the user the number that are written in the datafile.txt file. The purpose is that the results are presented organized by mantissa, characteristic, and sign. 

By reading the instructions, we understood what a mantissa is and what the characteristic expresses. Other thing that we had to consider was that the sign must be managed like a Char type variable because the compiler tends to multiplicative them and the result shown in the screen is incorrect.

The first thing we do was to declare several variables; type char to manage the signs, String to manage the mantissa and characteristic values, byte to declare a counter used in the process, and boolean to define different points that will work like a reference to solve the different situations according to the numbers read from the text file.

Then, we wrote some lines in a while cycle to read the numbers and we keep it on a array that is divided into char values by using the [array name].charAt(counter variable);

After that, we declared a switch structure that worked by analyzing the set of conditions given and following a corresponding path to the sign or exponent found in the data file.

Next, we added some if's above the switch structure that are going to be evaluated according to the elements found in the code lines.

Finally, the lines to show the result in the screen were already written, we only added the values to be shown.

Posted by Unknown

SDP03 - Exercise 05

Octubre 24, 2014

Este ejercicio consistió en calcular el promedio de una serie de números contenidos en un archivo de texto (.txt) que el programa es capaz de leer. A partir de tales valores se calculan las sumas y divisiones correspondientes al cálculo del promedio de una cantidad de números. 

Los operadores funcionaban ya que se estaban empleando valores double, por tanto el resultado era expresado con diferente cantidad de decimales y se aplicaron las reglas de redondeo por defecto, por lo tanto la precisión variaba un tanto; algo que para valores científicos podía ser inadecuado.

La solución fue utilizar una clase proporcionada por iCarnegie llamada UNumber, donde se incluyen desde variables y tipos de datos diferentes hasta métodos correspondientes a los tipos de datos relacionados.

A lo largo del ejercicio descubrimos cómo llevar a cabo actividades esenciales tales como declarar las variables, cargar valores, empleo de argumentos y, en general, cómo manipular los objetos creados a partir de la clase  UNumber.
viernes, 3 de octubre de 2014
Posted by Unknown
Now, we are presenting some pictures that show the results in the movements for the maze runner to get the finish line.

The path that the maze runner follows is determinated by the instructions in the method makemove().
We decided to add the following directions:

  1. Left (0,-1)
  2. Upwards (-1,0)
  3. Right (0,1)
  4. Downwards (1,0)

The image above show the result, we found out one of the quickest path to solve the maze.






miércoles, 1 de octubre de 2014
Posted by Unknown
September 30th, 2014

iCarnegie Project 01

Maze Runner

Today's activity was to solve the iCarnegie Project 01 in which the aim was to make the maze runner to leave the start line in order to get to the finish line. This will be solved through the algorithm that specifies the directions (upwards, downwards, left, and right) that the maze runner will follow.

The code lines were already started by iCarnegie developers, our task was to complete the code so that the application works properly.

  1. The first thing we do was to analyze the code lines and to run the application to see the result and discover what we could do to improve it.
  2. Then, we opened our four exercise projects to identify the methods that we might use in order to solve the errors and to add the functionality.
  3. According to the instructions, we placed our code lines in the pointed places.
  4. We ran the program several times and we could get the aim, that the maze runner (in a three-asterisk form) would walk through the paths and, finally, could get the finish line.
  5. We verified that the order of the movement methods was indispensable to determinate how fast or how slow the maze runner solved the maze. So, we tried different ways to order the direction methods and, finally, we found a very useful  algorithm that goes from the start line up to the finish line without returning or walking onto the same place more than once.
Throughout the activity, we discovered how to use the methods and apply the logical structure to solve the problem.
Welcome to My Blog

Popular Post

Blogger templates

Con tecnología de Blogger.

- Copyright © Zavala Zavala - Computing and Problem Solving -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -