-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestProgram.cpp
60 lines (44 loc) · 2.06 KB
/
TestProgram.cpp
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
// TestProgram.cpp
// SP2022 CSC-134 Group Project
// Group 8
#include "Student.h"
#include "ClassRoom.h"
#include <iostream>
#include <iomanip>
using namespace std;
// Dustin Smith
// Instructions from instructor:
// Note
// No global non-constant variables should be used.
// You can add more data members or member functions for Student and ClassRoom Class if needed.
// There should be NO stand-alone function, all functions should be member functions of class student or ClassRoom.
// Define code to perform object-oriented programming in main () function of TestProgram.cpp:
int main()
{
// Create a ClassRoom Object.
ClassRoom classRoom("CSC-134");
cout << "Classroom created. " << endl;
// Use the ClassRoom Object to create student object by reading student records from the input file “students.txt”
// and put the student objects in the array of Students which is the data member of ClassRoom object.
const string file = "studentinfo.txt";
classRoom.popArray(file);
cout << "studentinfo.txt opened. " << endl;
cout << endl;
//displaying the unsorted data
classRoom.displayStudentData();
// Use the ClassRoom Object to sort the array of students by student average score.
classRoom.sortArrayByAvg();
// Use the ClassRoom Object to display the students sorted by student average score.
cout << "\nSorted by avgerage scores: " << endl;
classRoom.displayStudentData();
// Use the ClassRoom Object to sort the array of students by student last name.
classRoom.sortArrayByLName();
// Use the ClassRoom Object to display the students sorted by student last name.
cout << "\nSorted by last name: " << endl;
classRoom.displayStudentData();
// Use the ClassRoom Object to display the number of Student objects created.
cout << "\nNumber of students in class: " << classRoom.getNumOfStudent() << endl;
// Use the ClassRoom Object to calculate and display the average score of all students.
cout << "\nAverage score of all students: " << classRoom.calcAvg() << endl;
return 0;
}