|
@@ -256,10 +256,10 @@ to generate random numbers in the range [min, max]. The method `randInt` depends
|
256
|
256
|
|
257
|
257
|
---
|
258
|
258
|
|
259
|
|
-##Laboratory session
|
|
259
|
+## Laboratory session
|
260
|
260
|
|
261
|
261
|
|
262
|
|
-###Exercise 1: Study the inheritance rules for the *Birds* family
|
|
262
|
+### Exercise 1 - Study the inheritance rules for the *Birds* family
|
263
|
263
|
|
264
|
264
|
#### The *Birds* family
|
265
|
265
|
|
|
@@ -268,7 +268,7 @@ Juana and Abelardo, mother and father birds, are about to have a baby they will
|
268
|
268
|
When the laboratory experience is finished, your program will create two birds (Juana and Abelardo) with random characteristics and a third bird (Piolín), with characteristics determined by the parent's characteristics, following a set of rules similar to the rules of genetic inheritance.
|
269
|
269
|
|
270
|
270
|
|
271
|
|
-### Inheritance rules
|
|
271
|
+#### Inheritance rules
|
272
|
272
|
|
273
|
273
|
**Eye color**
|
274
|
274
|
|
|
@@ -301,53 +301,57 @@ The gene dominance for the eyebrows is given by the following list, ordered from
|
301
|
301
|
|
302
|
302
|
The genes in the eyebrows follow these rules:
|
303
|
303
|
|
304
|
|
-a. If both parents have "angry" eyebrows, the baby will have "unibrow" eyebrows.
|
305
|
|
-b. If both parents have "unibrow" eyebrows, the baby will have "upset" eyebrows.
|
306
|
|
-c. In other cases, the baby will inherit the eyebrows with most dominance from the parent's eyebrows.
|
|
304
|
+ a. If both parents have "angry" eyebrows, the baby will have "unibrow" eyebrows.
|
|
305
|
+ b. If both parents have "unibrow" eyebrows, the baby will have "upset" eyebrows.
|
|
306
|
+ c. In other cases, the baby will inherit the eyebrows with most dominance from the parent's eyebrows.
|
307
|
307
|
|
308
|
308
|
|
309
|
|
-###Exercise 2: Study the `main` function
|
|
309
|
+### Exercise 2 - Study the `main` function
|
310
|
310
|
|
311
|
|
-**Instructions**
|
|
311
|
+#### Instructions:
|
312
|
312
|
|
313
|
|
-1. Load the project `Conditionals-BirthOfABird` onto Qt by double clicking the file `Conditionals-BirthOfABird.pro` in the folder `Documents/eip/Conditionals-BirthOfABird` on your computer. You can also go to `http://bitbucket.org/eip-uprrp/conditionals-birthofabird` to download the `Conditionals-BirthOfABird` folder to your computer.
|
|
313
|
+1. Load the project `BirthOfABird` into `QtCreator`. There are two ways to do this:
|
|
314
|
+
|
|
315
|
+ * Using the virtual machine: Double click the file `BirthOfABird.pro` located in the folder `/home/eip/labs/conditionals-birthofabird` of your virtual machine.
|
|
316
|
+ * Downloading the project’s folder from `Bitbucket`: Use a terminal and write the command `git clone http:/bitbucket.org/eip-uprrp/conditionals-birthofabird` to download the folder `conditionals-birthofabird` from `Bitbucket`. Double click the file `BirthOfABird.pro` located in the folder that you downloaded to your computer.
|
314
|
317
|
|
315
|
318
|
2. Configure the project.
|
316
|
319
|
|
317
|
|
-**Important:** In the "Configure Project" window, select the configuration Qt 5.3 or Qt 5.4 clang 64 bit. If you use another configuration the project will not compile.
|
|
320
|
+ **Important:** In the "Configure Project" window, select the configuration Qt 5.3 or Qt 5.4 clang 64 bit. If you use another configuration the project will not compile.
|
318
|
321
|
|
319
|
322
|
3. Compile and run the project. You should see a window with two birds that represent Juana and Abelardo. After a second, you will witness the birth of their baby, Piolín. Despite that, this Piolín could have been from another nest and not their son since it has random characteristics.
|
320
|
323
|
|
321
|
324
|
4. Open the file `main.cpp` (you will not make changes in any other file in this project). Study the `main` function. You will NOT make changes to the `main` function. Note that the `main` function essentially does two things:
|
322
|
|
- a. Creates three birds and adds two of them to the window.
|
323
|
|
-b. Creates a timer that waits a second and after invokes the `birth` function passing by reference to the window and the three birds.
|
|
325
|
+
|
|
326
|
+ a. Creates three birds and adds two of them to the window.
|
|
327
|
+ b. Creates a timer that waits a second and after invokes the `birth` function passing by reference to the window and the three birds.
|
324
|
328
|
|
325
|
|
----
|
|
329
|
+ ---
|
326
|
330
|
|
327
|
331
|
|
328
|
332
|
![funcionMain.png](images/funcionMain.png)
|
329
|
333
|
|
330
|
334
|
**Figure 2.** `Main` function.
|
331
|
335
|
|
332
|
|
----
|
|
336
|
+ ---
|
333
|
337
|
|
334
|
|
-###Exercise 3: Write the code to determine Piolín's characteristics
|
|
338
|
+### Exercise 3 - Write the code to determine Piolín's characteristics
|
335
|
339
|
|
336
|
340
|
Study the header for the `birth` function. In this function, write the necessary code so baby Piolín has the characteristics dictated by the rules of inheritance exposed previously.
|
337
|
341
|
|
338
|
|
----
|
|
342
|
+ ---
|
339
|
343
|
|
340
|
344
|
![funcionBirth.png](images/funcionBirth.png)
|
341
|
345
|
|
342
|
346
|
**Figure 3.** `Birth` function
|
343
|
347
|
|
344
|
|
----
|
|
348
|
+ ---
|
345
|
349
|
|
346
|
350
|
---
|
347
|
351
|
|
348
|
|
-##Deliverables
|
|
352
|
+## Deliverables
|
349
|
353
|
|
350
|
|
-Use "Deliverables" in Moodle to upload the `main.cpp` file with the modifications you made to the `birth` function. Remember to use good programming techniques, include the names of the programmers involved, and to document your program.
|
|
354
|
+Use "Deliverable" in Moodle to upload the `main.cpp` file with the modifications you made to the `birth` function. Remember to use good programming techniques, include the names of the programmers involved, and to document your program.
|
351
|
355
|
|
352
|
356
|
|
353
|
357
|
---
|