|
|
|
|
125
|
|
125
|
|
126
|
1. Load the project `QuadraticFrog` into `QtCreator`. There are two ways to do this:
|
126
|
1. Load the project `QuadraticFrog` into `QtCreator`. There are two ways to do this:
|
127
|
|
127
|
|
128
|
- * Using the virtual machine: Double click the file `QuadraticFrog.pro` located in the folder `home/eip/labs/expressions-quadraticFrog` of your virtual machine.
|
|
|
129
|
-
|
|
|
|
|
128
|
+ * Using the virtual machine: Double click the file `QuadraticFrog.pro` located in the folder `home/eip/labs/expressions-quadraticFrog` of your virtual machine.
|
130
|
* Downloading the project's folder from `Bitbucket`: Use a terminal and write the command `git clone http://bitbucket.org/eip-uprrp/expressions-quadraticfrog` to download the folder `expressions-quadraticfrog` from `Bitbucket`. Double click the file `QuadraticFrog.pro`located in the folder that you downloaded to your computer.
|
129
|
* Downloading the project's folder from `Bitbucket`: Use a terminal and write the command `git clone http://bitbucket.org/eip-uprrp/expressions-quadraticfrog` to download the folder `expressions-quadraticfrog` from `Bitbucket`. Double click the file `QuadraticFrog.pro`located in the folder that you downloaded to your computer.
|
131
|
|
130
|
|
132
|
2. Configure the project and run the program by clicking the green arrow in the menu on the left side of the Qt Creator window. The program will display a message saying that the quadratic formula is wrong. This happens because the program has testing instructions that verify that the code implementation is correct. Your program is missing the code for the quadratic formula, so this is why the message is displayed.
|
131
|
2. Configure the project and run the program by clicking the green arrow in the menu on the left side of the Qt Creator window. The program will display a message saying that the quadratic formula is wrong. This happens because the program has testing instructions that verify that the code implementation is correct. Your program is missing the code for the quadratic formula, so this is why the message is displayed.
|
|
|
|
|
166
|
|
165
|
|
167
|
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.
|
166
|
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.
|
168
|
|
167
|
|
169
|
- **Hints:**
|
|
|
|
|
168
|
+ **Hints:**
|
170
|
|
169
|
|
171
|
- 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.
|
|
|
|
|
170
|
+ 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.
|
172
|
|
171
|
|
173
|
- 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.
|
|
|
|
|
172
|
+ 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.
|
174
|
|
173
|
|
175
|
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.
|
174
|
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.
|
176
|
|
175
|
|