-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentList.h
More file actions
77 lines (56 loc) · 1.65 KB
/
StudentList.h
File metadata and controls
77 lines (56 loc) · 1.65 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
/*
Pham, Kidd (Team Leader)
Nguyen, Cindy
Dao, Kenneth
Rodriguez, Cele
Project: Grade Report
CS A250
Fall 2023
*/
#ifndef STUDENTLIST_H
#define STUDENTLIST_H
#include "Student.h"
#include <iostream>
#include <ostream>
#include <fstream>
class Node
{
public:
Node() : student(), next(nullptr) {}
Node(Student nStudent, Node* newNext) : student(nStudent), next(newNext) {}
Node* getNext() const { return next; }
Student getStudent() const { return student; }
void setStudent(Student newStudent) { student = newStudent; }
void setNext(Node* newNext) { next = newNext; }
~Node() {}
private:
Student student;
Node* next;
};
class StudentList
{
public:
StudentList() : first(nullptr), last(nullptr), count(0) {}
StudentList(const StudentList&);
StudentList& operator=(const StudentList&);
void addStudent(const Student&);
int getNoOfStudents() const;
void changeGrade();
void printStudentByID(int, double) const;
void printStudentByName(const std::string&) const;
void printStudentsByCourse(const std::string&, int) const;
void printAllStudents(double) const;
void printStudentsToFile(std::ofstream&, double) const;
void printStudentsOnHold(double) const;
void clearStudentList();
~StudentList();
private:
Node* first;
Node* last;
int count;
void copyCallingObjIsEmpty(const StudentList&);
void copyObjectsSameLength(const StudentList&);
void copyCallingObjLonger(const StudentList&);
void copyCallingObjShorter(const StudentList&);
};
#endif