소스 검색

README-en.md edited online with Bitbucket

부모
커밋
f8960a280d
1개의 변경된 파일29개의 추가작업 그리고 23개의 파일을 삭제
  1. 29
    23
      README-en.md

+ 29
- 23
README-en.md 파일 보기

@@ -5,10 +5,11 @@
5 5
 ![main2.png](images/main2.png)
6 6
 ![main3.png](images/main3.png)
7 7
 
8
+[Verano 2016- Tatiana] 
8 9
 
9 10
 A good way to organize and structure computer programs is dividing them into smaller parts using functions. Each function carries out a specific task of the problem that we are solving.
10 11
 
11
-You've seen that all programs written in C++ must contain the `main` function where the program begins. You've probably already used functions such as `pow`, `sin`, `cos`, or `sqrt` from the `cmath` library. Since in almost all of the upcoming lab activities you will continue using pre-defined functions, you need to understand how to work with them. In future exercises  you will learn how to design and validate functions. In this laboratory experience you will search and display information contained in a DVD data base to practice declaring simple functions and calling pre-defined functions.
12
+You've seen that all programs written in C++ must contain the `main` function where the program begins. You've probably already used functions such as `pow`, `sin`, `cos`, or `sqrt` from the `cmath` library. Since in almost all of the upcoming lab experiences you will continue using pre-defined functions, you need to understand how to work with them. In future exercises, you will learn how to design and validate functions. In this laboratory experience, you will search and display information contained in a DVD data base to practice declaring simple functions and calling pre-defined functions.
12 13
 
13 14
 
14 15
 ##Objectives:
@@ -34,7 +35,7 @@ Before you get to the laboratory you should have:
34 35
 
35 36
 2. Studied the concepts and instructions for the laboratory session.
36 37
 
37
-3. Taken the Pre-Lab quiz that can be found in Moodle.
38
+3. Taken the Pre-Lab quiz, available in Moodle.
38 39
 
39 40
 ---
40 41
 
@@ -44,7 +45,7 @@ Before you get to the laboratory you should have:
44 45
 
45 46
 In mathematics, a function $$f$$ is a rule that is used to assign to each element $$x$$ from a set called *domain*, one (and only one) element $$y$$ from a set called *range*. This rule is commonly represented with an equation, $$y=f(x)$$. The variable $$x$$ is the parameter of the function and the variable $$y$$ will contain the result of the function. A function can have more than one parameter, but only one result. For example, a function can have the form $$y=f(x_1,x_2)$$ where there are two parameters, and for each pair $$(a,b)$$ that is used as an argument in the function, the function has only one value of $$y=f(a,b)$$. The domain of the function tells us the type of value that the parameter should have and the range tells us the value that the returned result will have.
46 47
 
47
-Functions in programming languages are similar. A function has a series of instructions that take the assigned values as parameters and performs a certain task. In C++ and other programming languages, functions return only one result, as it happens in mathematics. The only difference is that a *programming* function could possibly not return any value (in this case the function is declared as `void`). If the function will return a value, we use the instruction `return`. As in math, you need to specify the types of values that the function's parameters and result will have; this is done when declaring the function.
48
+Functions in programming languages are similar. A function has a series of instructions that take the assigned values as parameters and performs a certain task. In C++ and other programming languages, functions return only one result, as it happens in mathematics. The only difference is that a *programming* function could possibly not return any value (in this case the function is declared as `void`). If the function returns a value, we use the instruction `return`. As in math, you need to specify the types of values that the function's parameters and result will have; this is done when declaring the function.
48 49
 
49 50
 ###Function header:
50 51
 
@@ -60,11 +61,11 @@ would be the header of the function called `example`, which returns an integer v
60 61
 
61 62
 ###Calling
62 63
 
63
-If we want to store the value of the `example` function's result in a variable `result` (that would be of type integer), we call the function by passing arguments as follows:
64
+If we want to store the value of the result of the function called `example` in a variable `result` (that would be of type integer), we call the function by passing arguments as follows:
64 65
 
65 66
 `result=example(2, 3.5, unCar);`
66 67
 
67
-Note that as the function is called, you don't include the type of the variables in the arguments. As in the definition for the function `example`, the third parameter `&var3` is a reference variable; what is being sent to the third argument when calling the function is a *reference* to the variable `unCar`. Any changes that are made on the variable `var3` will change the contents of the variable `unCar`.
68
+Note that as the function is called, you don't include the type of the variables in the arguments as in the definition for the function `example`. The third parameter `&var3` is a reference variable; what is being sent to the third argument when calling the function is a *reference* to the variable `unCar`. Any changes that are made on the variable `var3` will change the contents of the variable `unCar`.
68 69
 
69 70
 You can also use the function's result without having to store it in a variable. For example you could print it:
70 71
 
@@ -111,14 +112,14 @@ int example(char, int) ;
111 112
 int example(int, char) ;
112 113
 ```
113 114
 
114
-All of the above functions have the same name, `example`, but different parameters. The first and second functions have the same amount of parameters, but their arguments are of different types. The fourth and fifth functions have arguments of type `char` and `int`, but in each case are in different order.
115
+All of the above functions have the same name, `example`, but different parameters. The first and second functions have the same amount of parameters, but their arguments are of different types. The fourth and fifth functions have arguments of type `char` and `int`, but they have a different order in each case.
115 116
 
116
-In that last example, the function `example` is overloaded since there are 5 functions with different signatures but with the same name.
117
+In that last example, the function `example` is overloaded since there are five functions with different signatures but with the same name.
117 118
 
118 119
 
119
-### Default values
120
+### Default values
120 121
 
121
-Values by default can be assigned to the parameters of the functions starting from the first parameter to the right. It is not necessary to initialize all of the parameters, but the ones that are initialized should be consecutive: parameters in between two parameters cannot be left uninitialized. This allows calling the function without having to send values in the positions that correspond to the initialized parameters.
122
+Values by default can be assigned to the parameters of the functions starting from the rightmost parameter. It is not necessary to initialize all of the parameters, but the ones that are initialized should be consecutive: parameters in between two parameters cannot be left uninitialized. This allows calling the function without having to send values in the positions that correspond to the initialized parameters.
122 123
 
123 124
 **Examples of function headers and valid function calls:**
124 125
 
@@ -139,7 +140,7 @@ Here `var2` is initialized to 5 and `var3` to 10.
139 140
 
140 141
     b. `example(5, 3.3)` In this function call only the first two parameters are given values, and the value for the last parameter is the value by default. That is, the value for `var1` within the function will be 5, that of `var2` will be 3.3, and `var3` will be 10.
141 142
 
142
-    c. `example(5)` In this function call only the first parameter is given a value, and the last two parameters will be assigned  values by default. That is, `var1` will be 5, `var2` will be 5.0, and `var3` will be 10.
143
+    c. `example(5)` In this function call only the first parameter is given a value, and the last two parameters will be assigned values by default. That is, `var1` will be 5, `var2` will be 5.0, and `var3` will be 10.
143 144
 
144 145
 
145 146
 **Example of a valid function header with invalid function calls:**
@@ -150,11 +151,11 @@ Here `var2` is initialized to 5 and `var3` to 10.
150 151
 
151 152
     a. `example(5, , 10)` This function call is **invalid** because it leaves an empty space in the middle argument.
152 153
 
153
-    b. `example()` This function call is **invalid** because `var1` was not assigned a default value. A valid call to the function `example` needs at least one argument (the first). 
154
+    b. `example()` This function call is **invalid** because `var1` was not assigned as a default value. A valid call to the function `example` needs at least one argument (the first). 
154 155
 
155 156
 **Examples of invalid function headers:**
156 157
 
157
-1. `int example(int var1=1, float var2, int var3)` This header is invalid because  the  default values can only be assigned starting from the rightmost parameter.
158
+1. `int example(int var1=1, float var2, int var3)` This header is invalid because the default values can only be assigned starting from the rightmost parameter.
158 159
 
159 160
 2. `int example(int var1=1, float var2, int var3=10)` This header is invalid because you can't place parameters without values between other parameters with default values. In this case, `var2` doesn't have a default value but `var1` and `var3` do.
160 161
 
@@ -164,7 +165,7 @@ Here `var2` is initialized to 5 and `var3` to 10.
164 165
 
165 166
 ##DVD movies and the DVD data base
166 167
 
167
-DVD stands for "digital versatile disk" or "digital video disk", which is an optical disc format for storing digital information invented by Philips, Sony, Toshiba, and Panasonic in 1995. The DVD offers larger storage capacity than compact disks (CD), but have the same dimensions. DVDs can be used to store any kind of digital data, but are famous for their use in the distribution of movies.
168
+DVD stands for "digital versatile disk" or "digital video disk", which is an optical disc format for storing digital information invented by Philips, Sony, Toshiba, and Panasonic in 1995. The DVD offers larger storage capacity than compact disks (CD), but has the same dimensions. DVDs can be used to store any kind of digital data, but they are famous for their use in the distribution of movies.
168 169
 
169 170
 
170 171
 ---
@@ -172,16 +173,16 @@ DVD stands for "digital versatile disk" or "digital video disk", which is an opt
172 173
 ---
173 174
 
174 175
 
175
-!INCLUDE "../../eip-diagnostic/DVD/en/diag-dvd-01.html"
176
+!INCLUDE "../../eip-diagnostic/DVD/en/diag-dvd-01.html"
176 177
 <br>
177 178
 
178
-!INCLUDE "../../eip-diagnostic/DVD/en/diag-dvd-03.html"
179
+!INCLUDE "../../eip-diagnostic/DVD/en/diag-dvd-03.html"
179 180
 <br>
180 181
 
181
-!INCLUDE "../../eip-diagnostic/DVD/en/diag-dvd-11.html"
182
+!INCLUDE "../../eip-diagnostic/DVD/en/diag-dvd-11.html"
182 183
 <br>
183 184
 
184
-!INCLUDE "../../eip-diagnostic/DVD/en/diag-dvd-12.html"
185
+!INCLUDE "../../eip-diagnostic/DVD/en/diag-dvd-12.html"
185 186
 <br>
186 187
 
187 188
 <br>
@@ -194,7 +195,7 @@ DVD stands for "digital versatile disk" or "digital video disk", which is an opt
194 195
 
195 196
 ## Laboratory session
196 197
 
197
-In this laboratory session we will be using a data base of DVD movies maintained by http://www.hometheaterinfo.com/dvdlist.htm. This database contains 44MB of information for movies that have been distributed in DVD. Some of the stored information in the database for each DVD is: DVD title, publishing studio, date of publication, type of sound, versions, price, rating, year and genre. The fields of information for each movie are stored in text with the following format:
198
+In this laboratory session we will be using a data base of DVD movies maintained by http://www.hometheaterinfo.com/dvdlist.htm. This database contains 44MB of information for movies that have been distributed in DVD. Some of the stored information in the database for each DVD is: DVD title, publishing studio, date of publication, type of sound, versions, price, rating, year and genre. The fields of the information for each movie are stored in text with the following format:
198 199
 
199 200
 `DVD_Title|Studio|Released|Status|Sound|Versions|Price|Rating|Year|Genre|Aspect|UPC|DVD_ReleaseDate|ID|Timestamp`
200 201
 
@@ -207,11 +208,13 @@ Airplane! (Paramount/ Blu-ray/ Checkpoint)|Paramount||Discontinued|5.1 DTS-HD|LB
207 208
 
208 209
 ###Exercise 1
209 210
 
210
-The first step in this lab experience is to familiarize yourself with the functions that are already defined in the code. Your tasks require that you imitate what the functions do, so it is important that you understand how to call, declare and define the functions. 
211
+The first step in this lab experience is to familiarize yourself with the functions that are already defined in the code. Your tasks require that you imitate what the functions do, for this reason it is important that you understand how to call, declare and define the functions. 
211 212
 
212 213
 **Instructions**
213 214
 
214
-1. Open the project `DVDInfo` in Qt by double clicking the file `DVDInfo.pro` in the folder `Documents/eip/Functions-DVDInfo` on your computer. You may also access `http://bitbucket.org/eip-uprrp/functions-dvdinfo` to download the folder `Functions-DVDInfo` to your computer.
215
+1. Load the project `DVDInfo` into `QtCreateor`. There are two wayss to do this: 
216
+        		* Using the virtual machine: Double click the file `DVDInfo.pro` located in the folder `home/eip/labs/functions-dvdinfo` of your virtual machine. 
217
+		* Downloading the project's folder from `Bitbucket`: Use a terminal and write the command `git clone http://bitbucket.org/eip-uprrp/functions-dvdinfo` to download the folder `functions-dvdinfo` from `Bitbucket`. Double click the file `DVDInfo.pro` located in the folder that you downloaded to your computer. 
215 218
 
216 219
 2. Configure the project. The file `main.cpp` has the function calls that you will use in the next exercises. The declarations and definitions of the functions that will be called can be found in the files `movie.h` and `movie.cpp`.
217 220
 
@@ -226,11 +229,11 @@ The first step in this lab experience is to familiarize yourself with the functi
226 229
     getMovieByName
227 230
     ```
228 231
 
229
-4. You can find the function definitions in the file `movie.cpp`. Note that some versions of the function `showMovie` use the object called`fields` of the `QStringList` class. The purpose of this object is to provide easy access to information fields of each movie, using an index between 0 and 14.  For example, you may use fields[0] to access a movie’s title, fields[1] to access a movie’s studio, fields[8] to access its year, and so forth.
232
+4. You can find the function definitions in the file `movie.cpp`. Note that some versions of the function `showMovie` use the object called `fields` of the `QStringList` class. The purpose of this object is to provide easy access to information fields of each movie, using an index between 0 and 14.  For example, you may use fields[0] to access a movie’s title, fields[1] to access a movie’s studio, fields[8] to access its year, and so forth.
230 233
 
231 234
 ---
232 235
 
233
-!INCLUDE "../../eip-diagnostic/DVD/en/diag-dvd-06.html"
236
+!INCLUDE "../../eip-diagnostic/DVD/en/diag-dvd-06.html"
234 237
 <br>
235 238
 <br>
236 239
 
@@ -248,7 +251,7 @@ In this exercise you will modify the `main` function and some of the pre-defined
248 251
 
249 252
 4. For the movie in part 3 of this exercise, add the necessary code to the `main` function so that the program displays the name and the rating of the movie.
250 253
 
251
-5. Modify the `getMovieInfo` function in the file `movie.cpp` so that it receives an additional parameter by reference to which the name of the movie will be assigned. Remember that you must also modify the function's prototype in `movie.h`.
254
+5. Modify the `getMovieInfo` function in the file `movie.cpp` so that it receives an additional parameter by reference where the name of the movie will be assigned. Remember that you must also modify the function's prototype in `movie.h`.
252 255
 
253 256
 6. For the movie in part 3, add the necessary code to the `main` function so that, using `getMovieInfo`, it displays the name, rating, year and the genre of the movie in one line. Hint: note that the function `getMovieInfo` has parameters that are passed by reference. 
254 257
 
@@ -291,3 +294,6 @@ Use "Deliverables" in Moodle to hand in the files `main.cpp`, `movie.cpp`, and `
291 294
 [3] http://www.soft32.com/blog/platforms/windows/keep-your-dvd-collection-up-to-date-with-emdb-erics-movie-database/
292 295
 
293 296
 [4] http://www.hometheaterinfo.com/dvdlist.htm
297
+
298
+
299
+