// ***************************************************************** // Author: Zhixiang Chen // Class: CSCI/CMPE 1170, Spring 2009 // Lab 29: Header file for Lab 29 // Date: January 12, 2009 // Comment: The code here is meant to be revised. // ***************************************************************** #include #include #include using namespace std; #ifndef LAB_29_HEAD_H #define LAB_29_HEAD_H //define studentClass class class studentClass { private: string firstName, //firstnames for students lastName, //last names for students ID; //IDs for students double record[COLUMN]; //record of attendance, hw1, ..., hw6, quiz, test1, test2, test3 double score; //scores for students char grade; //letter grades public: //default constructor studentClass(); //another constructor studentClass(const string fn, const string ln, const string ID, const double pts, const double scr, const char gr); //method to access private members string getName(){ return firstName + " " + lastName;} //inline method string getID(){return ID;} //inline method double getScore(){ return score;} //inline method char getGrade(){return grade;} //inline method void getRecord(double rcd[ ], const int s); //methods to set or process private data members void setName(const string fn, const string ln); void setID(const string id); void setRecord( const double rcd[ ], const int s); void computeScoreGrade(); //method to show show the result void printStudent(); //destructor ~studentClass(); }; /******************************************************************************************** The following are implementation of class methods ********************************************************************************************/ //default constructor studentClass::studentClass() { firstName = ""; lastName = ""; ID = ""; for (int i=0; i= 90) grade = 'A'; else if (grade >= 80) grade = 'B'; else if (grade >= 70) grade = 'C'; else if (grade >= 60) grade = 'D'; else grade = 'F'; } //getrecod void studentClass:: getRecord(double rcd[ ], const int s) { for( int i=0; i= 90) grade = 'A'; else if (grade >= 80) grade = 'B'; else if (grade >= 70) grade = 'C'; else if (grade >= 60) grade = 'D'; else grade = 'F'; } //method to show show the result void studentClass:: printStudent() { cout << setw(16)<> fn //get first name >> ln //get last name >> id; //get ID for (int col = 0; col > rcd[col]; //get a row for csci1380 } csci1380[row].setName(fn, ln); //set name csci1380[row].setID(id); //set ID csci1380[row].setRecord(rcd, COLUMN); //set record csci1380[row].computeScoreGrade(); //compute score and grade } } /**************************************************************** This is for you to complete: This function displays class information for CSCI 1380 in some nice format. ****************************************************************/ void showGrades(const studentClass csci1380[], const int SIZE) { //your code is here. } #endif