Last active
June 8, 2017 19:13
-
-
Save bilijo/1d798400630e35ad8f5acad2c1355875 to your computer and use it in GitHub Desktop.
report card class - v1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This Class is indented to manage some grades informations about a student. | |
* A teacher is able to set and get, grade notes relative to some courses the student follows | |
* | |
* @author (damir Males) | |
* @version (v1 02 juin 2017) | |
*/ | |
public class ReportCard | |
{ | |
// instance variables will contains the student name and three grades , math, history and french | |
private String studentName = ""; | |
private String mathGrade = ""; | |
private String historyGrade = ""; | |
private String frenchGrade = ""; | |
/** | |
* Constructor for objects of class ReportCard | |
*/ | |
public ReportCard(String mStudentName, String mMathGrade, String mHistoryGrade, String mFrenchGrade ) | |
{ | |
// initialize instance variables | |
studentName = mStudentName; | |
mathGrade = mMathGrade; | |
historyGrade = mHistoryGrade; | |
frenchGrade = mFrenchGrade; | |
} | |
/** | |
* get the student name of the report card | |
*/ | |
public String getStudentName() | |
{ | |
return studentName; | |
} | |
/** | |
* get the math grade of the student | |
*/ | |
public String getMathGrade() | |
{ | |
return mathGrade; | |
} | |
/** | |
* get the history grade of the student | |
*/ | |
public String getHistoryGrade() | |
{ | |
return historyGrade; | |
} | |
/** | |
* get the french grade of the student | |
*/ | |
public String getFrenchGrade() | |
{ | |
return frenchGrade; | |
} | |
/** | |
* Set the student name of the report card | |
*/ | |
public void setStudentName(String mStudentName) | |
{ | |
studentName = mStudentName; | |
} | |
/** | |
* Set the math grade of the student | |
*/ | |
public void setMathGrade(String mMathGrade) | |
{ | |
mathGrade = mMathGrade; | |
} | |
/** | |
* Set the history grade of the student | |
*/ | |
public void setHistoryGrade(String mHistoryGrade) | |
{ | |
historyGrade = mHistoryGrade; | |
} | |
/** | |
* Set the french grade of the student | |
*/ | |
public void setFrenchGrade(String mFrenchGrade) | |
{ | |
frenchGrade = mFrenchGrade; | |
} | |
/** | |
* Concatenate all datas included in the class using the toString method | |
*/ | |
public String toString() { | |
return "Student's Name" + this.studentName + | |
" : Math's Grade " + this.mathGrade + | |
", History's Grade " + this.historyGrade + | |
", French's Grade " + this.frenchGrade; | |
} | |
} |
Adding toString() method to the class
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same naming convention between variables declared in the constructor and these used int sets and gets functions