Rafael Arce Nazario пре 9 година
родитељ
комит
996c0c52f4
1 измењених фајлова са 33 додато и 46 уклоњено
  1. 33
    46
      README.md

+ 33
- 46
README.md Прегледај датотеку

@@ -39,10 +39,6 @@ Antes de llegar al laboratorio debes:
39 39
 
40 40
 3. haber tomado el quiz Pre-Lab que se encuentra en Moodle.
41 41
 
42
----
43
----
44
-
45
-
46 42
 
47 43
 ##Fórmula cuadrática
48 44
 
@@ -50,9 +46,9 @@ Una *ecuación cuadrática* tiene la forma
50 46
 
51 47
 $$y = a x^2+ b x + c,$$
52 48
 
53
-donde $a, b, c$ son números reales y $a\not=0$. La gráfica de una ecuación cuadrática es una *parábola* que abre hacia arriba si $a > 0$ y abre hacia abajo si $a < 0$. 
49
+donde $$a, b, c$$ son números reales y $$a\not=0$$. La gráfica de una ecuación cuadrática es una *parábola* que abre hacia arriba si $$a > 0$$ y abre hacia abajo si $$a < 0$$. 
54 50
 
55
-Una gráfica interseca el eje de $x$ cuando $y=0$. Por lo tanto, si una parábola interseca el eje de $x$, los intersectos están dados por las soluciones reales de la ecuación
51
+Una gráfica interseca el eje de $$x$$ cuando $$y=0$$. Por lo tanto, si una parábola interseca el eje de $$x$$, los intersectos están dados por las soluciones reales de la ecuación
56 52
 
57 53
 $$0 = a x^2 + b x + c.$$
58 54
 
@@ -60,9 +56,9 @@ Las soluciones a la ecuación anterior se pueden obtener utilizando la *fórmula
60 56
 
61 57
 $$x=\frac{-b±\sqrt{b^2-4ac}}{2a}.$$
62 58
 
63
-Nota que si el *discriminante*  $b^2-4ac$ de la fórmula cuadrática es negativo, los valores de $x$ serán números imaginarios y no se pueden graficar en el plano cartesiano porque los puntos $(x,y)$ en este plano tienen coordenadas que son números reales. Por lo tanto, si el discriminante es negativo, la parábola no interseca el eje de $x$. Si el discriminate es igual a $0$, entonces la parábola interseca el eje de $x$ en un solo punto (solo el vértice toca el eje de $x$).
59
+Nota que si el *discriminante*  $$b^2-4ac$$ de la fórmula cuadrática es negativo, los valores de $$x$$ serán números imaginarios y no se pueden graficar en el plano cartesiano porque los puntos $$(x,y)$$ en este plano tienen coordenadas que son números reales. Por lo tanto, si el discriminante es negativo, la parábola no interseca el eje de $$x$$. Si el discriminate es igual a $$0$$, entonces la parábola interseca el eje de $$x$$ en un solo punto (solo el vértice toca el eje de $$x$$).
64 60
 
65
-Si el discriminante es positivo, la fórmula cuadrática nos dá dos soluciones a la ecuación $0 = a x^2 + b x + c$ y estas soluciones son los intersectos en el eje de $x$. Por ejemplo, supón que la fórmula cuadrática nos dá dos valores 
61
+Si el discriminante es positivo, la fórmula cuadrática nos dá dos soluciones a la ecuación $$0 = a x^2 + b x + c$$ y estas soluciones son los intersectos en el eje de $$x$$. Por ejemplo, supón que la fórmula cuadrática nos dá dos valores 
66 62
 
67 63
 $$x=x_1$$
68 64
 $$x=x_2$$
@@ -72,13 +68,13 @@ Entonces,
72 68
 $$a x^2 + b x + c = a(x-x_1)(x-x_2),$$
73 69
 
74 70
 
75
-donde $x_1$ y $x_2$ son los cortes en el eje de $x$. Si $a<0$, la gráfica de la parábola será similar a la de la Figura 1.
71
+donde $$x_1$$ y $$x_2$$ son los cortes en el eje de $$x$$. Si $$a<0$$, la gráfica de la parábola será similar a la de la Figura 1.
76 72
 
77 73
 ---
78 74
 
79 75
 ![parabola.png](images/parabola.png)
80 76
 
81
-<b>Figura 1.</b> Parábola que abre hacia abajo e interseca el eje de $x$ en $x_1$ y $x_2$.
77
+<b>Figura 1.</b> Parábola que abre hacia abajo e interseca el eje de $$x$$ en $$x_1$$ y $$x_2$$.
82 78
 
83 79
 
84 80
 ---
@@ -87,11 +83,11 @@ Nota que la ecuación
87 83
 
88 84
 $$y=-(x-x_1)(x-x_2)$$
89 85
 
90
-es una ecuación cuadrática cuya parábola abre hacia abajo e  interseca el eje de $x$ en  $x_1$ y $x_2$. Por ejemplo, la ecuación
86
+es una ecuación cuadrática cuya parábola abre hacia abajo e  interseca el eje de $$x$$ en  $$x_1$$ y $$x_2$$. Por ejemplo, la ecuación
91 87
 
92 88
 $$y=-(x+2)(x-3)=-x^2+x+6$$
93 89
 
94
-es una ecuación cuadrática cuya parábola abre hacia abajo e interseca el eje de $x$ en $x_1=-2$ y $x_2=3$. Nota que, en esta ecuación, los valores de $a,b,c$  son $a=-1, \ b=1, \ c=6$.
90
+es una ecuación cuadrática cuya parábola abre hacia abajo e interseca el eje de $$x$$ en $$x_1=-2$$ y $$x_2=3$$. Nota que, en esta ecuación, los valores de $$a,b,c$$  son $$a=-1, \ b=1, \ c=6$$.
95 91
 
96 92
 ---
97 93
 ---
@@ -100,7 +96,7 @@ es una ecuación cuadrática cuya parábola abre hacia abajo e interseca el eje
100 96
 
101 97
 ###Ejercicio 1
102 98
 
103
-En este ejercicio implementarás la fórmula cuadrática para completar un juego en el que un sapito brinca de una hoja a otra. Asumirás que las hojas están localizadas sobre el eje de $x$ y que el brinco del sapito estará determinado por una parábola que abre hacia abajo. Si quieres que el sapito brinque de hoja a hoja, debes hayar una ecuación cuadrática cuya parábola abra hacia abajo e interseque el eje de $x$ en los lugares donde están localizadas las hojas. Tu tarea es escribir las ecuaciones para la fórmula cuadrática.
99
+En este ejercicio implementarás la fórmula cuadrática para completar un juego en el que un sapito brinca de una hoja a otra. Asumirás que las hojas están localizadas sobre el eje de $$x$$ y que el brinco del sapito estará determinado por una parábola que abre hacia abajo. Si quieres que el sapito brinque de hoja a hoja, debes hayar una ecuación cuadrática cuya parábola abra hacia abajo e interseque el eje de $$x$$ en los lugares donde están localizadas las hojas. Tu tarea es escribir las ecuaciones para la fórmula cuadrática.
104 100
 
105 101
 
106 102
 
@@ -118,7 +114,7 @@ En este ejercicio implementarás la fórmula cuadrática para completar un juego
118 114
 
119 115
     $$result=\frac{-b-\sqrt{b^2-4ac}}{2a}.$$
120 116
 
121
-    Los otros archivos del proyecto tienen código que hará pruebas a  las ecuaciones que escribiste evaluando varios valores para $a, b ,c$ y verificando que el resultado que producen las ecuaciones es el esperado.  La validación del código de un programa es una parte importante de el desarrollo de programas y proyectos.
117
+    Los otros archivos del proyecto tienen código que hará pruebas a  las ecuaciones que escribiste evaluando varios valores para $$a, b ,c$$ y verificando que el resultado que producen las ecuaciones es el esperado.  La validación del código de un programa es una parte importante de el desarrollo de programas y proyectos.
122 118
 
123 119
 4. Ejecuta el programa marcando el botón verde en el menú de la izquierda. Si las ecuaciones que escribiste están correctas, deberá aparecer una ventana parecida a la Figura 2.
124 120
 
@@ -134,7 +130,7 @@ En este ejercicio implementarás la fórmula cuadrática para completar un juego
134 130
 
135 131
 5. Entrega el archivo `QuadraticFormula.cpp` que contiene las funciones las funciones `QuadraticPlus` y `QuadraticMinus` utilizando   "Entrega 1" en Moodle. Recuerda utilizar buenas prácticas de programación, incluir el nombre de los programadores y documentar tu programa.
136 132
 
137
-6. Para jugar, el sapito deberá brincar de una hoja a otra. Nota que las hojas tienen valores para $x_1$ y $x_2$. Estos valores representan los intercectos en el eje de $x$ de la parábola. Debes entrar los valores para los coeficientes $a,b,c$ de la ecuación cuadrática de modo que la gráfica sea una parábola que abra hacia abajo e interseque el eje de $x$ en los valores $x_1, x_2$ que salen en las hojas. Puedes obtener los valores de $a,b,c$ notando que 
133
+6. Para jugar, el sapito deberá brincar de una hoja a otra. Nota que las hojas tienen valores para $$x_1$$ y $$x_2$$. Estos valores representan los intercectos en el eje de $$x$$ de la parábola. Debes entrar los valores para los coeficientes $$a,b,c$$ de la ecuación cuadrática de modo que la gráfica sea una parábola que abra hacia abajo e interseque el eje de $$x$$ en los valores $$x_1, x_2$$ que salen en las hojas. Puedes obtener los valores de $$a,b,c$$ notando que 
138 134
 
139 135
  $$a x^2 + b x + c = a(x-x_1)(x-x_2),$$
140 136
 
@@ -146,16 +142,14 @@ En este ejercicio implementarás la fórmula cuadrática para completar un juego
146 142
 
147 143
 En este ejercicio escribirás un  programa para obtener el promedio de puntos para la nota de un estudiante.
148 144
 
149
-Supón que todos los cursos en la Universidad de Yauco son de $3$ créditos y que las notas tienen las siguientes puntuaciones: $A = 4$ puntos por crédito; $B = 3$ puntos por crédito; $C = 2$ puntos por crédito; $D = 1$ punto por crédito y $F = 0$ puntos por crédito. 
145
+Supón que todos los cursos en la Universidad de Yauco son de $$3$$ créditos y que las notas tienen las siguientes puntuaciones: $$A = 4$$ puntos por crédito; $$B = 3$$ puntos por crédito; $$C = 2$$ puntos por crédito; $$D = 1$$ punto por crédito y $$F = 0$$ puntos por crédito. 
150 146
 
151 147
 **Instrucciones**
152 148
 
153 149
 1. Crea un nuevo proyecto "Non-Qt" llamado Promedio. Tu función `main()`  contendrá el código necesario para pedirle al usuario el número de A's, B's, C's, D's y F's obtenidas por el estudiante y computar el promedio de puntos para la nota (GPA por sus siglas en inglés).
154 150
 
155
-2. Tu código debe definir las constantes $A=4, B=3, C=2, D=1, F=0$ para la puntuación de las notas, y pedirle al usuario que entre los valores para las variables $NumA$, $NumB$, $NumC$, $NumD$, $NumF$. La variable $NumA$ representará el número de cursos en los que el estudiante obtuvo $A$,  $NumB$ representará el número de cursos en los que el estudiante obtuvo $B$, etc. El programa debe desplegar el GPA del estudiante en una escala de 0 a 4 puntos. 
156
-
157
-
158
-
151
+2. Tu código debe definir las constantes $$A=4, B=3, C=2, D=1, F=0$$ para la puntuación de las notas, y pedirle al usuario que entre los valores para las variables $$NumA$$, $$NumB$$, $$NumC$$, $$NumD$$, $$NumF$$. La variable $$NumA$$ representará el número de cursos en los que el estudiante obtuvo $$A$$,  $$NumB$$ representará el número de cursos en los que el estudiante obtuvo $$B$$, etc. El programa debe desplegar el GPA del estudiante en una escala de 0 a 4 puntos. 
152
+    
159 153
     **Ayudas:** 
160 154
 
161 155
     1. El promedio se obtiene sumando las puntuaciones  correspondientes a las notas obtenidas (por ejemplo, una A en un curso de 3 créditos tiene una puntuación de 12), y dividiendo esa suma por el número total de créditos.
@@ -165,9 +159,7 @@ Supón que todos los cursos en la Universidad de Yauco son de $3$ créditos y qu
165 159
 3. Verifica tu programa calculando el promedio de un estudiante que tenga dos A y dos B; ¿qué nota tendría este estudiante, A o B (la A va desde 3.5 a 4.0)?. Cuando tu programa esté correcto, guarda el archivo `main.cpp` y entrégalo  utilizando  "Entrega 2" en Moodle. Recuerda seguir las instrucciones en el uso de nombres y tipos para las variables,  incluir el nombre de los programadores, documentar tu programa y utilizar buenas prácticas de programación. 
166 160
 
167 161
 
168
----
169
----
170
----
162
+
171 163
 
172 164
 
173 165
 
@@ -212,8 +204,7 @@ Before you get to the laboratory you should have:
212 204
 
213 205
 
214 206
 
215
----
216
----
207
+
217 208
 
218 209
 
219 210
 
@@ -224,9 +215,9 @@ A *quadratic equation* has a form
224 215
 
225 216
 $$y = a x^2+ b x + c,$$
226 217
 
227
-where $a, b, c$ are real numbers and $a\not=0$. The graph of a quadratic equation is a *parabola* that opens up if $a > 0$ and opens dawn if $a < 0$.
218
+where $$a, b, c$$ are real numbers and $$a\not=0$$. The graph of a quadratic equation is a *parabola* that opens up if $$a > 0$$ and opens dawn if $$a < 0$$.
228 219
 
229
-A graph intersects the $x$-axis when $y=0$. Therefore, if a parabola intersects the $x$-axis, the intersects are given by the real solutions to the equation
220
+A graph intersects the $$x$$-axis when $$y=0$$. Therefore, if a parabola intersects the $$x$$-axis, the intersects are given by the real solutions to the equation
230 221
 
231 222
 
232 223
 
@@ -238,9 +229,9 @@ The solutions to the previous equation can be obtained using the *quadratic form
238 229
 
239 230
 $$x=\frac{-b±\sqrt{b^2-4ac}}{2a}.$$
240 231
 
241
-Note that if the *discriminant*   $b^2-4ac$ of the quadratic formula is negative, the values of $x$ are complex numbers and are not plotted in the Cartesian plane. Therefore, if the discriminant is negative, the parabola does not intersect the $x$-axis. If the discriminant is equal to $0$, then the parabola intersects the $x$-axis in only one point (only the vertex touches the $x$-axis).
232
+Note that if the *discriminant* $$b^2-4ac$$ of the quadratic formula is negative, the values of $$x$$ are complex numbers and are not plotted in the Cartesian plane. Therefore, if the discriminant is negative, the parabola does not intersect the $$x$$-axis. If the discriminant is equal to $$0$$, then the parabola intersects the $$x$$-axis in only one point (only the vertex touches the $$x$$-axis).
242 233
 
243
-If the discriminant is positive, the quadratic formula gives two solutions to the equation $0 = a x^2 + b x + c$ and these solutions are the intersects in the $x$-axis. For example, suppose that the quadratic formula gives two values
234
+If the discriminant is positive, the quadratic formula gives two solutions to the equation $$0 = a x^2 + b x + c$$ and these solutions are the intersects in the $$x$$-axis. For example, suppose that the quadratic formula gives two values
244 235
 
245 236
 
246 237
 
@@ -251,13 +242,13 @@ Then,
251 242
 
252 243
 $$a x^2 + b x + c = a(x-x_1)(x-x_2),$$
253 244
 
254
-where $x_1$ and $x_2$ are the intersects in the $x$-axis. If $a<0$, the graph of the parabola will be similar to the one in Figure 1.
245
+where $$x_1$$ and $$x_2$$ are the intersects in the $$x$$-axis. If $$a<0$$, the graph of the parabola will be similar to the one in Figure 1.
255 246
 
256 247
 ---
257 248
 
258 249
 ![parabola.png](images/parabola.png)
259 250
 
260
-<b>Figure 1.</b> Parabola that opens down and intersects the $x$-axis in $x_1$ and $x_2$.
251
+<b>Figure 1.</b> Parabola that opens down and intersects the $$x$$-axis in $$x_1$$ and $$x_2$$.
261 252
 
262 253
 
263 254
 ---
@@ -267,12 +258,12 @@ Note that the equation
267 258
 
268 259
 $$y=-(x-x_1)(x-x_2)$$
269 260
 
270
-is a quadratic equation and its parabola opens down and intersects the $x$-axis in $x_1$ and $x_2$. For example, the equation
261
+is a quadratic equation and its parabola opens down and intersects the $$x$$-axis in $$x_1$$ and $$x_2$$. For example, the equation
271 262
 
272 263
 
273 264
 $$y=-(x+2)(x-3)=-x^2+x+6$$
274 265
 
275
-is a quadratic equation with a parabola that opens down and intersects the $x$-axis at $x_1=-2$ and $x_2=3$. Note that, in this equation, the values for $a, b, c$ are  $a=-1, \ b=1, \ c=6$.
266
+is a quadratic equation with a parabola that opens down and intersects the $$x$$-axis at $$x_1=-2$$ and $$x_2=3$$. Note that, in this equation, the values for $$a, b, c$$ are  $$a=-1, \ b=1, \ c=6$$.
276 267
 
277 268
 
278 269
 ---
@@ -282,7 +273,7 @@ is a quadratic equation with a parabola that opens down and intersects the $x$-a
282 273
 
283 274
 ###Exercise 1
284 275
 
285
-In this exercise you will implement the quadratic formula to complete a game in which a frog leaps from one leaf to another. You will assume that the leaves are in the $x$-axis and that the leap is determined by a parabola that opens down. If you want the frog to leap from leaf to leaf, you must find a quadratic equation with a parabola that opens down and intersects the $x$-axis in the places where the leaves are located. Your task is to write the equations for the quadratic formula.
276
+In this exercise you will implement the quadratic formula to complete a game in which a frog leaps from one leaf to another. You will assume that the leaves are in the $$x$$-axis and that the leap is determined by a parabola that opens down. If you want the frog to leap from leaf to leaf, you must find a quadratic equation with a parabola that opens down and intersects the $$x$$-axis in the places where the leaves are located. Your task is to write the equations for the quadratic formula.
286 277
 
287 278
 
288 279
 
@@ -301,7 +292,7 @@ In this exercise you will implement the quadratic formula to complete a game in
301 292
 
302 293
     $$result=\frac{-b-\sqrt{b^2-4ac}}{2a}.$$
303 294
 
304
-    The other files of the project have code that will test your equations by evaluating several choices for $a, b, c$ and verifying that the equations produce the expected result. Code validation is an important part of software development.
295
+    The other files of the project have code that will test your equations by evaluating several choices for $$a, b, c$$ and verifying that the equations produce the expected result. Code validation is an important part of software development.
305 296
 
306 297
 
307 298
 4. Run the program by clicking the green arrow in the menu on the left side of the Qt Creator window. If your equations are implemented correclty, you should obtain a window similar to the one in Figure 2.
@@ -318,12 +309,11 @@ In this exercise you will implement the quadratic formula to complete a game in
318 309
 
319 310
 5. Use "Deliverable 1" in Moodle to submit the file  `QuadraticFormula.cpp` containing the code with the functions `QuadraticPlus` and `QuadraticMinus`. Remember to use good programming practices, to include the names of the programmers and to document your program.
320 311
 
321
-6. To play, the frog should leap jump from one leaf to another. Note that the leaves have values for $x_1$ and $x_2$. These values represent the intersects of the parabola with the $x$-axis. You should input the values for the coefficients $a, b, c$ of the quadratic equation so that its graph that is a parabola that opens down and intersects the $x$-axis in the values $x_1, x_2$ shown in the leaves. You can obtain these values noting that
312
+6. To play, the frog should leap jump from one leaf to another. Note that the leaves have values for $$x_1$$ and $$x_2$$. These values represent the intersects of the parabola with the $$x$$-axis. You should input the values for the coefficients $$a, b, c$$ of the quadratic equation so that its graph that is a parabola that opens down and intersects the $$x$$-axis in the values $$x_1, x_2$$ shown in the leaves. You can obtain these values noting that
322 313
 
314
+    $$a x^2 + b x + c = a(x-x_1)(x-x_2),$$
323 315
 
324
- $$a x^2 + b x + c = a(x-x_1)(x-x_2),$$
325
-
326
- as in the explanation above. 
316
+    as in the explanation above. 
327 317
 
328 318
 
329 319
 
@@ -332,21 +322,18 @@ In this exercise you will implement the quadratic formula to complete a game in
332 322
 
333 323
 In this exercise you will write a program to obtain a student's grade point average (GPA).
334 324
 
335
-Suppose that all courses in Cheo's University are 3 credits each and have the following point values: $A = 4$ points per credit; $B = 3$ points per credit; $C = 2$ points per credit; $D = 1$ point per credit y $F = 0$ points per credit. 
325
+Suppose that all courses in Cheo's University are 3 credits each and have the following point values: $$A = 4$$ points per credit; $$B = 3$$ points per credit; $$C = 2$$ points per credit; $$D = 1$$ point per credit y $$F = 0$$ points per credit. 
336 326
 
337 327
 **Instructions**
338 328
 
339 329
 1. Start a new "Non-Qt" project called "Average". Your `main()` function will contain the necessary code to ask the user for the number of A's, B's, C's, D's and F's obtained and compute the grade point average (GPA).
340 330
 
341
-2. Your code should define the constants  $A=4, B=3, C=2, D=1, F=0$ for the points per credit, and ask the user to input the values for the variables  $NumA$, $NumB$, $NumC$, $NumD$, $NumF$. The variable $NumA$ represents the number of courses in which the student obtained A, $NumB$ represents the number of courses in which the student obtained B, etc. The program should display the GPA using the 0-4 point scale.
331
+2. Your code should define the constants  $$A=4, B=3, C=2, D=1, F=0$$ for the points per credit, and ask the user to input the values for the variables  $$NumA$$, $$NumB$$, $$NumC$$, $$NumD$$, $$NumF$$. The variable $$NumA$$ represents the number of courses in which the student obtained A, $$NumB$$ represents the number of courses in which the student obtained B, etc. The program should display the GPA using the 0-4 point scale.
342 332
 
343 333
     **Hints:** 
344
-
334
+    
345 335
     1. You can obtain the GPA by adding the credit points corresponding to the grades (for example, an A in a 3 credit course has a value of 12 points), and dividing this sum by the total number of credits.
346
-
347
-
336
+    
348 337
     2. Remember that, in C++, when both operands in the division are integers, the result will also be an integer; the remainder will be discarded. Use "type casting": `static_cast\<type\>(expression)' to solve this problem.
349 338
 
350 339
 3. Verify your program by computing the GPA of a student that has two A's and 2 B's; what is the grade of this student, A or B (A goes from 3.5 to 4 points)? When your program is correct, save the `main.cpp` file and submit it using "Deliverable 2" in Moodle. Remember to follow the instructions regarding the names and types of the variables,  to include the names of the programmers, to document your program and to use good programming practices.
351
-
352
-