/**************************************************************************************
* ------------------------------------------------------------------------------------
* File name: Advisee.java
* Project name: CSCI 1250 Project 5
* ------------------------------------------------------------------------------------
* Author Name: Austin Stanley
* Author E-mail: stanleyar@goldmail.etsu.edu
* Course-Section: CSCI-1250-001
* Creation Date: 11/16/2012
* Date of Last Modification: 11/16/2012
* ------------------------------------------------------------------------------------
*/
/**************************************************************************************
* Class Name: Advisee <br>
* Class Purpose: The class for our driver program <br>
*
* <hr>
* Date created: 11/16/2102 <br>
* Date last modified: 11/16/2012
* @author Austin Stanley
*/
public class Advisee //The beginning of the Advisee class
{
//***********************CLASS ATTRIBUTES******************************************
private String studentName; //Establishg the studentName variable
private String studentID; //Establishg the studentID variable
private String studentConcentration; //Establishg the studentConcentration variable
private int studentNumberOfHours; //Establishg the studentNumberOfHours variable
private String studentAdvisorName; //Establishg the studentAdvisorName variable
private boolean studentMajor; //Establishg the studentMajor variable
private boolean studentIntentToGraduate; //Establishg the studentIntentToGraduate variable
//**********************CLASS METHODS***********************************************
//--------------------------CONSTRUCTORS--------------------------------------------
/**********************************************************************************
* Method Name: Advisee <br>
* Method Purpose: It is a no-arg constructor for this class.
*
* <br>
*
* <hr>
* Date created: 11/16/2012 <br>
* Date last modified: 11/16/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
*/
public Advisee() //No Arg Constructor
{
setStudentName("XXX XXXXX");
setStudentID("XXXXXXXX");
setStudentConcentration("XX");
setStudentNumberOfHours(0);
setStudentAdvisorName("XXX XXXXX");
setStudentMajor(false);
setStudentIntentToGraduate(false);
}//end Advisee()
/**********************************************************************************
* Method Name: Advisee <br>
* Method Purpose: A constructor accepting a value for all atributes
*
* <br>
*
* <hr>
* Date created: 11/16/2012 <br>
* Date last modified: 11/16/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @param String stuName
* @param String stuID
* @param String stuConcentration
* @param int stuNumberOfHours
* @param String stuAdvisorName
* @param boolean stuMajor
* @param boolean stuIntentToGraduate
*/
public Advisee(String stuName, String stuID, String stuConcentration, //Constructor that uses ALL attributes
int stuNumberOfHours, String stuAdvisorName, boolean stuMajor, boolean stuIntentToGraduate)
{
setStudentName(stuName);
setStudentID(stuID);
setStudentConcentration(stuConcentration);
setStudentNumberOfHours(stuNumberOfHours);
setStudentAdvisorName(stuAdvisorName);
setStudentMajor(stuMajor);
setStudentIntentToGraduate(stuIntentToGraduate);
}//end publc BookOrder constructor with all seven attributes
/**********************************************************************************
* Method Name: Advisee(Advisee nextStudent) <br>
* Method Purpose: It is a copy constructor for this class.
*
* <br>
*
* <hr>
* Date created: 11/19/2012 <br>
* Date last modified: 11/19/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
*/
public Advisee(Advisee nextStudent) //Copy Constructor. Used for multiple instances
{
setStudentName(nextStudent.studentName);
setStudentID(nextStudent.studentID);
setStudentConcentration(nextStudent.studentConcentration);
setStudentNumberOfHours(nextStudent.studentNumberOfHours);
setStudentAdvisorName(nextStudent.studentAdvisorName);
setStudentMajor(nextStudent.studentMajor);
setStudentIntentToGraduate(nextStudent.studentIntentToGraduate);
}//end Advisee(Advisee nextStudent)
//*********************************SETTERS*****************************************
/**********************************************************************************
* Method Name: setStudentName <br>
* Method Purpose: Set the studentName's attribute.
*
* <br>
*
* <hr>
* Date created: 11/16/2012 <br>
* Date last modified: 11/16/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @param String stuName
*/
public void setStudentName(String stuName) //The setter for studentName
{
studentName = stuName;
}//end setStudentName
/**********************************************************************************
* Method Name: setStudentID <br>
* Method Purpose: Set the studentID's attribute.
*
* <br>
*
* <hr>
* Date created: 11/16/2012 <br>
* Date last modified: 11/16/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @param String stuID
*/
public void setStudentID(String stuID) //Setter for studentID
{
studentID = stuID;
}//end setStudentID
/**********************************************************************************
* Method Name: setStudentConcentration <br>
* Method Purpose: Set the studentConcentration's attribute.
*
* <br>
*
* <hr>
* Date created: 11/16/2012 <br>
* Date last modified: 11/16/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @param String stuConcentration
*/
public void setStudentConcentration(String stuConcentration) //Setter for studentConcentration
{ //Will accept lower case but stores upper
studentConcentration = stuConcentration;
if (stuConcentration.equalsIgnoreCase("CS"))
studentConcentration = "CS";
else if (stuConcentration.equalsIgnoreCase("IS"))
studentConcentration = "IS";
else if (stuConcentration.equalsIgnoreCase("IT"))
studentConcentration = "IT";
else
studentConcentration = "XX"; //XX is the default answer
}//end setStudentConcentration
/**********************************************************************************
* Method Name: setStudentNumberOfHours<br>
* Method Purpose: Set the studentNumberOfHour's attribute.
*
* <br>
*
* <hr>
* Date created: 11/16/2012 <br>
* Date last modified: 11/16/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @param int stuNumberOfHours
*/
public void setStudentNumberOfHours(int stuNumberOfHours) //Setter for studentNumberOfHours
{
studentNumberOfHours = stuNumberOfHours;
}//end setStudentNumberOfHours
/**********************************************************************************
* Method Name: setStudentAdvisorName <br>
* Method Purpose: Set the studentAdvisorName's attribute.
*
* <br>
*
* <hr>
* Date created: 11/16/2012 <br>
* Date last modified: 11/16/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @param String stuAdvisorName
*/
public void setStudentAdvisorName(String stuAdvisorName) //Setter for studentAdvisorName
{
studentAdvisorName = stuAdvisorName;
}//end setStudentAdvisorName
/**********************************************************************************
* Method Name: setStudentMajor <br>
* Method Purpose: Set the studentMajor's attribute.
*
* <br>
*
* <hr>
* Date created: 11/16/2012 <br>
* Date last modified: 11/16/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @param boolean stuAdvisorName
*/
public void setStudentMajor(boolean stuMajor) //Setter for studentMajor
{
studentMajor = stuMajor;
}//end setStudentMajor
/**********************************************************************************
* Method Name: setStudentIntentToGraduate <br>
* Method Purpose: Set the studentID's attribute.
*
* <br>
*
* <hr>
* Date created: 11/16/2012 <br>
* Date last modified: 11/16/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @param boolean stuIntentToGraduate
*/
public void setStudentIntentToGraduate(boolean stuIntentToGraduate) //Setter for studentIntentToGraduate
{
studentIntentToGraduate = stuIntentToGraduate;
}//end setStudentIntentToGraduate
//*************************************GETTERS************************************
/**********************************************************************************
* Method Name: getStudentName <br>
* Method Purpose: Return the student name.
*
* <br>
*
* <hr>
* Date created: 11/17/2012 <br>
* Date last modified: 11/17/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @return String studentName
*/
public String getStudentName() //Getter for Student Name
{
return studentName;
}//end getStudentName
/**********************************************************************************
* Method Name: getStudentID <br>
* Method Purpose: Return the student ID.
*
* <br>
*
* <hr>
* Date created: 11/17/2012 <br>
* Date last modified: 11/17/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @return String studentID
*/
public String getStudentID() //Getter for Student ID
{
return studentID;
}//end getStudentID
/**********************************************************************************
* Method Name: getStudentConcentration <br>
* Method Purpose: Return the student's concentration.
*
* <br>
*
* <hr>
* Date created: 11/17/2012 <br>
* Date last modified: 11/17/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @return String studentConcentration
*/
public String getStudentConcentration() //Getter for Student Concentration
{
return studentConcentration;
}//end getStudentConcentration
/**********************************************************************************
* Method Name: getStudentNumberOfHours <br>
* Method Purpose: Return the student's numbers of hours.
*
* <br>
*
* <hr>
* Date created: 11/17/2012 <br>
* Date last modified: 11/17/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @return int studentNumberOfHours
*/
public int getStudentNumberOfHours() //Getter for Student Number Of Hours
{
return studentNumberOfHours;
}//end getStudentNumberOfHours
/**********************************************************************************
* Method Name: getStudentAdvisorName <br>
* Method Purpose: Return the student's advisor name.
*
* <br>
*
* <hr>
* Date created: 11/17/2012 <br>
* Date last modified: 11/17/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @return String studentAdvisorName
*/
public String getStudentAdvisorName() //Getter for Student Advisor Name
{
return studentAdvisorName;
}//end getStudentAdvisorName
/**********************************************************************************
* Method Name: getStudentMajor <br>
* Method Purpose: Return the student's major.
*
* <br>
*
* <hr>
* Date created: 11/17/2012 <br>
* Date last modified: 11/17/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @return boolean studentMajor
*/
public boolean getStudentMajor() //Getter for Student's Major
{
return studentMajor;
}//end getStudentMajor
/**********************************************************************************
* Method Name: getStudentIntentToGraduate <br>
* Method Purpose: Return the student's intent to graduate.
*
* <br>
*
* <hr>
* Date created: 11/17/2012 <br>
* Date last modified: 11/17/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* None
*
* <hr>
* @return boolean studentIntentToGraduate
*/
public boolean getStudentIntentToGraduate() //Getter for Author
{
return studentIntentToGraduate;
}//end getStudentIntentToGraduate
/**********************************************************************************
* Method Name: getClassification <br>
* Method Purpose: To get the students grade classification
*
* <br>
*
* <hr>
* Date created: 11/1/2012 <br>
* Date last modified: 11/1/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* • for an undergraduate: Freshman < 30 hours, Sophomore 30-59 hours,
* Junior 60-89, Senior 90 and up
*
* <hr>
* @return String classification
*/
public String getClassification()
{
String classification = " "; //Comparing number of hours to see what classification the advisee falls in
if (getStudentNumberOfHours() < 30)
classification = "Freshman";
else if (getStudentNumberOfHours() >= 30 && (getStudentNumberOfHours() <= 59))
classification = "Sophomore";
else if (getStudentNumberOfHours() >= 60 && (getStudentNumberOfHours() <= 89))
classification = "Junior";
else
classification = "Senior";
return classification;
}//end getClassification
/**********************************************************************************
* Method Name: metGraduationRequirements <br>
* Method Purpose: To see if the student has met all requirements
*
* <br>
*
* <hr>
* Date created: 11/1/2012 <br>
* Date last modified: 11/1/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* student must have completed at least 120 credit hours
* student must have filed an intent to graduate
* student must have filed a major sheet
* <hr>
* @return boolean requirements
*/
public boolean metGraduationRequirements()
{
boolean requirements = false;
int credithours = getStudentNumberOfHours();
boolean intent = getStudentIntentToGraduate(); //This method takes all requirements needed to graduate
boolean major = getStudentMajor(); //and tests them, if all come back true, it is assigned true
if(credithours >= 120 && intent == true && major == true) //if one is false it will remain false
requirements = true;
return requirements;
}//end metGraduationRequirements
/**********************************************************************************
* Method Name: clearedToGraduateMsg <br>
* Method Purpose: To return a string stating Yes a student has met everything
* Or No, and listing all reasons why they have not.
* <br>
*
* <hr>
* Date created: 11/17/2012 <br>
* Date last modified: 11/17/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* not enough hours;
* not completed major sheet;
* not filed intent to graduate
*
* <hr>
* @return String cleared
*/
public String clearedToGraduateMsg()
{
String cleared = ""; //Created string to be returned
String creditError = ""; //Created string to contain the error message
String intentError = ""; //It will add more if an error occurs
String majorError = "";
int creditHours = getStudentNumberOfHours(); //Store the number of hours in an easier to use variable
boolean metGrad = metGraduationRequirements(); //Find the true or false of grad requirements
boolean credit; //True or false of enough credit hours
boolean intent = getStudentIntentToGraduate(); //True or false of intent
boolean major = getStudentMajor(); //True or false of major sheet
if(creditHours >= 120)
credit = true; //This just compares credit hours to see if it gets a
else //true or a false stored into it
credit = false;
if(credit == false)
creditError = " not enough hours;"; //If credit is false we store an error message
else creditError = ""; //If credit is true, it gets nothing
if(intent == false)
intentError = " not filed intent to graduate;"; //The same procedure, if false, stores
else intentError = ""; //an error message, nothing if true
if(major == false)
majorError = " not completed major sheet;"; //The same procedure, if false, stores
else majorError = ""; //an error message, nothing if true
if(metGrad == false) //Check graduation requirements, if it was false previously it will catch the errors
cleared = ("No -" + creditError + intentError + majorError); //and assign the appropriate error messages
else
cleared = ("Yes - all requirements have been met"); //If yes, we present the all have been met message
return cleared;
}//end clearedToGraduateMsg
/**********************************************************************************
* Method Name: toString <br>
* Method Purpose: A string that designs the output of all information
*
* <br>
*
* <hr>
* Date created: 11/19/2012 <br>
* Date last modified: 11/19/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
* Not a display, just a design
*
*
*
* <hr>
* @return String
*/
public String toString() //This will simply organize information to be presented
{
return("\n\n Advisee Information"
+"\n\n------------------------------------------"
+"\n\n Name: " + studentName //calling any variables we need
+"\n ID: " + studentID
+"\n\n\n Advisor: " + studentAdvisorName
+"\n\n\n Concentration: " + studentConcentration
+"\n Completed Hours: " + studentNumberOfHours
+"\n Classification: " + getClassification() //Cant call Classification as it
+"\n Cleared for graduation: " + clearedToGraduateMsg()); //needs calculations
}//end toString
/**********************************************************************************
* Method Name: equals(Advisee student) <br>
* Method Purpose: To compare two advisee's and see if they are the same.
*
* <br>
*
* <hr>
* Date created: 11/21/2012 <br>
* Date last modified: 11/21/2012 <br>
*
* <hr>
* Notes on specifications, special algorithms, and assumptions:
*
*
*
*
* <hr>
* @return boolean
*/
public boolean equals(Advisee student)
{
//Default it is false. Next we compare all variables.
return(studentName == student.studentName && studentID == student.studentID && studentAdvisorName == student.studentAdvisorName
&& studentConcentration == student.studentConcentration && studentNumberOfHours == student.studentNumberOfHours
&& studentMajor == student.studentMajor && studentIntentToGraduate == student.studentIntentToGraduate);
//Returns a boolean, true or false
}//end equals(Advisee student)
}//end Advisee