-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator.cpp
More file actions
85 lines (69 loc) · 3.08 KB
/
Calculator.cpp
File metadata and controls
85 lines (69 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "Calculator.h"
#include <iostream>
#include <iomanip>
using namespace std;
void programs(int numProg, double prog[30], double &ptsTotal, double &ptsEarned) {
double ptsProg = 30;
for (int x = 0; x <= numProg; x++) {
ptsTotal += ptsProg;
ptsEarned += ptsProg * prog[x];
}
}
void practicums(int numPract, double pract[30], double &ptsTotal, double &ptsEarned) {
double ptsPract;
for (int count = numPract - 1; count >= 0; count--) {
if (count >= 7)//if the practicum number is 8-10
ptsPract = 100;
else if (count == 6)//if the practicum number is 7
ptsPract = 75;
else if (count >= 3)//if the practicum number is 4-6
ptsPract = 50;
else//if the practicum number is 1-3
ptsPract = 25;
ptsTotal += ptsPract;
ptsEarned += ptsPract * pract[count];
}
}
void groupProjects(double groupProg, double &ptsTotal, double &ptsEarned) {
double ptsGroup = 300;
ptsTotal += ptsGroup;
ptsEarned += ptsGroup * groupProg;
}
void exams(int numExam, double exams[2], double &ptsTotal, double &ptsEarned) {
double ptsExam = 300;
for (int x = 0; x < numExam; x++) {
ptsTotal = ptsTotal + ptsExam;
ptsEarned += 300 * exams[x];
}
}
void final(int numFinal, double finals[2], double &ptsTotal, double &ptsEarned) {
double ptsFinal = 800;
for (int x = 0; x < numFinal; x++) {
ptsTotal += ptsFinal;
ptsEarned += ptsFinal * finals[x];
}
}
void print(double ptsEarnedProg, double ptsTotalProg, double ptsEarnedPract, double ptsTotalPract,
double ptsEarnedGroup, double ptsTotalGroup, double ptsEarnedExams, double ptsTotalExams,
double ptsEarnedFinals, double ptsTotalFinals, ofstream &output) {
if (ptsEarnedProg > 1)
output << "Percent on programs " << fixed << setprecision(2) << ptsEarnedProg / ptsTotalProg * 100 << "%\n";
if (ptsEarnedPract > 1)
output << "Percent on practicums " << fixed << setprecision(2) << ptsEarnedPract / ptsTotalPract * 100 << "%\n";
if (ptsEarnedExams > 1)
output << "Percent on exams " << fixed << setprecision(2) << ptsEarnedExams / ptsTotalExams * 100 << "%\n";
if (ptsEarnedGroup > 1.0)
output << "Percent on the group project " << fixed << setprecision(2) << ptsEarnedGroup / ptsTotalGroup * 100
<< "%\n";
if (ptsEarnedFinals > 1)
output << "Percent on finals " << fixed << setprecision(2) << ptsEarnedFinals / ptsTotalFinals * 100 << "%\n";
}
void printOut(double ptsEarnedProg, double ptsTotalProg, double ptsEarnedPract, double ptsTotalPract,
double ptsEarnedGroup, double ptsTotalGroup, double ptsEarnedExams, double ptsTotalExams,
double ptsEarnedFinals, double ptsTotalFinals, double &ptsTotal, double &ptsEarned, ofstream &output) {
ptsTotal = ptsTotalProg + ptsTotalPract + ptsTotalGroup + ptsTotalExams + ptsTotalFinals;
ptsEarned = ptsEarnedProg + ptsEarnedPract + ptsEarnedGroup + ptsEarnedExams + ptsEarnedFinals;
output << "Total Points Lost: " << ptsTotal - ptsEarned << endl;
output << ptsEarned << " / " << ptsTotal << endl;
output << fixed << setprecision(3) << ptsEarned / ptsTotal * 100 << "%" << endl;
}