|
@@ -5,7 +5,7 @@
|
5
|
5
|
![rsz_mariposa.png](images/rsz_mariposa.png)
|
6
|
6
|
|
7
|
7
|
|
8
|
|
-[Verano 2016 - Ive]
|
|
8
|
+[Verano 2016 - Ive - Rafa]
|
9
|
9
|
|
10
|
10
|
Arithmetic expressions are an essential part of almost any algorithm that solves a useful problem. Therefore, a basic skill in any computer programming language is to implement arithmetic expressions correctly. In this laboratory experience you will practice the implementation of arithmetic expressions in C++ by writing parametric equations to plot interesting curves.
|
11
|
11
|
|
|
@@ -102,6 +102,14 @@ To plot a curve that is described by parametric equations, we compute the $$x$$
|
102
|
102
|
!INCLUDE "../../eip-diagnostic/pretty-plots/en/diag-pretty-plots-04.html"
|
103
|
103
|
<br>
|
104
|
104
|
|
|
105
|
+!INCLUDE "../../eip-diagnostic/pretty-plots/en/diag-pretty-plots-05.html"
|
|
106
|
+<br>
|
|
107
|
+
|
|
108
|
+!INCLUDE "../../eip-diagnostic/pretty-plots/en/diag-pretty-plots-06.html"
|
|
109
|
+<br>
|
|
110
|
+
|
|
111
|
+!INCLUDE "../../eip-diagnostic/pretty-plots/en/diag-pretty-plots-07.html"
|
|
112
|
+<br>
|
105
|
113
|
|
106
|
114
|
|
107
|
115
|
---
|
|
@@ -134,6 +142,7 @@ To plot a curve that is described by parametric equations, we compute the $$x$$
|
134
|
142
|
|
135
|
143
|
3. The file `main.cpp` (in Sources) contains the function `main()` where you will be adding code. Open this file and study the code.
|
136
|
144
|
|
|
145
|
+ ```cpp
|
137
|
146
|
QApplication a(argc, argv);
|
138
|
147
|
XYPlotWindow wLine;
|
139
|
148
|
XYPlotWindow wCircle;
|
|
@@ -156,6 +165,7 @@ To plot a curve that is described by parametric equations, we compute the $$x$$
|
156
|
165
|
// After all the points have been added, plot and show the graph
|
157
|
166
|
wLine.Plot();
|
158
|
167
|
wLine.show();
|
|
168
|
+ ```
|
159
|
169
|
|
160
|
170
|
The line `XYPlotWindow wLine;` creates the object `wLine`, that is the window that will show the plot of a graph, in this case the graph of a segment. Look at the `for` loop. In this cycle several values for $$t$$ are generated and a value for $$x$$ and $$y$$ is computed for each $$t$$. Each ordered pair $$(x,y)$$ is added to the graph of the segment by the method `AddPointToGraph(x,y)`. After the cycle, there is a call to the method `Plot()`, to "draw" the points on the graph, and to the method `show()`, to show the plot. The *methods* are functions that allow us to work with the data of an object. Note that each of the methods is written after `wLine`, and followed by a period. In a future laboratory experience you will learn more about objects and practice how to create them and invoke their methods.
|
161
|
171
|
|
|
@@ -207,17 +217,6 @@ In this exercise you will write a program to obtain a student's grade point aver
|
207
|
217
|
a. 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.
|
208
|
218
|
|
209
|
219
|
b. 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.
|
210
|
|
-
|
211
|
|
- ---
|
212
|
|
-
|
213
|
|
-!INCLUDE "../../eip-diagnostic/pretty-plots/en/diag-pretty-plots-05.html"
|
214
|
|
-<br>
|
215
|
|
-
|
216
|
|
-!INCLUDE "../../eip-diagnostic/pretty-plots/en/diag-pretty-plots-06.html"
|
217
|
|
-<br>
|
218
|
|
-
|
219
|
|
-!INCLUDE "../../eip-diagnostic/pretty-plots/en/diag-pretty-plots-07.html"
|
220
|
|
-<br>
|
221
|
220
|
|
222
|
221
|
3. Verify your program by computing the GPA of a student that has two A's and 2 B's; what is the average of this student? When your program is correct, save the `main.cpp` file.
|
223
|
222
|
|