#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; } Student::Student(char* s_key) { strcpy(key, s_key); } 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; } 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; } void Student::set_key(char *s_key) { strcpy(key, s_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& out, const Student &s) { out << endl << endl << "Student ID number: " << s.key << endl; out << s.last_name << ", " << s.first_name; if(s.gpa == 0.0) out << " GPA is not available for this student.\n"; else out << " GPA: " << s.gpa << endl << endl << endl; return out; } void Student::operator= (Student &s) { strcpy(last_name, s.last_name); strcpy(first_name, s.first_name); strcpy(key, s.key); gpa = s.gpa; } int Student::operator == (Student &s) { if(strcmp(key, s.key) == 0) return 1; return 0; }