diff options
| author | till-t <[email protected]> | 2021-10-27 22:10:47 -0700 |
|---|---|---|
| committer | till-t <[email protected]> | 2021-10-27 22:10:47 -0700 |
| commit | 9adcd572601facc69fce40b7492a4395e341c291 (patch) | |
| tree | 9f36849a43fbac91ee5fa7f4819afd9128c65783 /Lab5_taormina | |
| parent | Add online IDE url (diff) | |
| download | cst116-lab5-till-t-9adcd572601facc69fce40b7492a4395e341c291.tar.xz cst116-lab5-till-t-9adcd572601facc69fce40b7492a4395e341c291.zip | |
Lab 5 INCOMPLETE as of 27 oct, 2021
Diffstat (limited to 'Lab5_taormina')
| -rw-r--r-- | Lab5_taormina | 180 |
1 files changed, 180 insertions, 0 deletions
diff --git a/Lab5_taormina b/Lab5_taormina new file mode 100644 index 0000000..7f52421 --- /dev/null +++ b/Lab5_taormina @@ -0,0 +1,180 @@ +//Tyler Taormina +//Lab 5 CST 116 +//October 2021 + +LAB 5 +________________________________________________________________________________________________________________________ +9a +10.5 Learn by Doing Exercises +p 247 +10 pts #1 +Submit: code & run +CODE: + +#include <iostream> +using namespace std; + +const int NUM_SCORES = 10; +const int NUM_STUDENTS = 10; + + +int main() +{ + float currStudent[NUM_SCORES]{0.0}; + char LetterGrades[NUM_SCORES]; + float total = 0.0, average = 0.0; + int A = 0, B = 0, C = 0, D = 0, F = 0; + + //Read scores + for (int i = 0; i < NUM_SCORES; i++) + { + cout << "Enter Score #" << i + 1 << " of " << NUM_SCORES << ": " << endl; + cin >> currStudent[i]; + } + + //Letter Grade List + for (int i = 0; i < NUM_STUDENTS; i++) + { + //Letter Grade A + if (currStudent[i] >= 92.0) + { + LetterGrades[i] = char(65); + A += 1; + } + + //Letter Grade B + else if (currStudent[i] < 92.0 && currStudent[i] >= 84.0) + { + LetterGrades[i] = char(66); + B += 1; + } + + //Letter Grade C + else if (currStudent[i] < 84.0 && currStudent[i] >= 75.0) + { + LetterGrades[i] = char(67); + C += 1; + } + + //Letter Grade D + else if (currStudent[i] < 75.0 && currStudent[i] >= 65.0) + { + LetterGrades[i] = char(68); + D += 1; + } + + //Letter Grade F + else + { + LetterGrades[i] = char(70); //F + F += 1; + } + } + + + //Calculate average score for class + for (int i = 0; i < NUM_SCORES; i++) + { + total += currStudent[i]; + } + average = total / NUM_STUDENTS; + + //Print Info + for (int i = 0; i < NUM_SCORES; i++) + { + cout << "Student " << i + 1 << " Letter Grade: " << LetterGrades[i]; + cout << " and Score: " << currStudent[i] << endl; + } + + cout << endl; + cout << endl; + cout << "Class Average: " << average << endl; + + cout << "A's: " << A << endl; + cout << "B's: " << B << endl; + cout << "C's: " << C << endl; + cout << "D's: " << D << endl; + cout << "F's: " << F << endl; + + return 0; +} + + +RUN: +C:\Users\Till\CLionProjects\gitDemo\cmake-build-debug\gitDemo.exe +Enter Score #1 of 10: +100 +Enter Score #2 of 10: +90 +Enter Score #3 of 10: +74 +Enter Score #4 of 10: +74 +Enter Score #5 of 10: +89 +Enter Score #6 of 10: +44 +Enter Score #7 of 10: +44 +Enter Score #8 of 10: +89 +Enter Score #9 of 10: +59 +Enter Score #10 of 10: +5 +Student 1 Letter Grade: A and Score: 100. +Student 2 Letter Grade: B and Score: 90. +Student 3 Letter Grade: D and Score: 74. +Student 4 Letter Grade: D and Score: 74. +Student 5 Letter Grade: B and Score: 89. +Student 6 Letter Grade: F and Score: 44. +Student 7 Letter Grade: F and Score: 44. +Student 8 Letter Grade: B and Score: 89. +Student 9 Letter Grade: F and Score: 59. +Student 10 Letter Grade: F and Score: 5. + + +Class Average: 66.8 +A's: 1 +B's: 3 +C's: 0 +D's: 2 +F's: 4 + +Process finished with exit code 0 + +________________________________________________________________________________________________________________________ +9b +10.6 Learn by Doing Exercises +p 253 +Break into 3 files: the main() file, the functions .cpp file and the .h file. +10 pts #1 +Submit: code & runs +CODE: + +COMPLETE BUT NEED TO FIND OUT HOW MARTHA WANTS SUBMITTED + +RUN: + + +________________________________________________________________________________________________________________________ +10a +9.4 Learn by Doing Exercises +p 260 +Break into at least 3 files as in 9b. +10 pts #2 +Submit: code & runs +CODE: + +RUN: + +________________________________________________________________________________________________________________________ +10b +9.5 Learn by Doing Exercises +p 273 +Break into at least 3 files as in 9b. +10 pts #7 Write a full program to do this. +Submit: code & runs +CODE: + +RUN: |