#include "student.h" Student::Student() { strcpy(last_name, ""); strcpy(first_name, ""); strcpy(key, ""); gpa = 0.0; } Student::Student(char* s_last, char* s_first, double s_gpa, char* s_key) { strcpy(last_name, s_last); strcpy(first_name, s_first); strcpy(key, s_key); gpa = s_gpa; } Student::Student(char* s_last, char* s_first ) { strcpy(last_name, s_last); strcpy(first_name, s_first); gpa = 0.0; } void Student::set_last_name(char* s_last) { strcpy(last_name, s_last); } void Student::set_first_name(char* s_first) { strcpy(first_name, s_first); } void Student::set_gpa(double s_gpa) { gpa = s_gpa; } void Student::set_key(char *k) { strcpy(key, k); } double Student::get_gpa() { return gpa; } char* Student::get_last_name() { return last_name; } char* Student::get_first_name() { return first_name; } char* Student::get_key() { return key; } //returns the length of the student' last name int Student::get_last_length() { return strlen(last_name); } //returns the length of the student' first name int Student::get_first_length() { return strlen(first_name); } //cout operator overloading ostream &operator << (ostream&, const Student &s) { cout << "Student ID number: " << s.key << endl; cout << endl << s.last_name << ", " << s.first_name; if(s.gpa == 0.0) cout << " GPA is not available for this student.\n"; else cout << "\tGPA: " << s.gpa << endl; return cout; } //= operator overloading void Student::operator= (Student &s) { strcpy(last_name, s.last_name); strcpy(first_name, s.first_name); strcpy(key, s.key); gpa = s.gpa; } //== operator overloading int Student::operator == (Student &s) { if(strcmp(key, s.key) == 0) return 1; return 0; }