示例#1
0
/******************************************************************************
 * Student()
 * 	This default constructor will create a Student object
 *****************************************************************************/
MathStudent::MathStudent() :  Student()
{
#ifdef TEST
cout << "Default Constructor is Called" << endl << endl;
#endif

	setAddress("");
	setCity("");
	setState("");
	setZipCode(0);
}
示例#2
0
/******************************************************************************
 * Student()
 * 	This constructor will receive the student's name and id and create a
 * 		student object with that info
 *****************************************************************************/
MathStudent::MathStudent(string	studentName,		//The Student's Name
						int		studentId)			//The Student's ID
: Student(studentName, studentId)
{
#ifdef TEST
cout << "Non-default Constructor is Called" << endl << endl;
#endif
	setAddress("");
	setCity("");
	setState("");
	setZipCode(0);
}
示例#3
0
/******************************************************************************
 * MathStudent()
 * 	This copy constructor will read in a Math Student Object, and do a deep
 * 		copy to the math student  object being created
 *****************************************************************************/
MathStudent::MathStudent(const MathStudent &anotherMathStudent)
												//Another Math Student
{
#ifdef TEST
cout << "Copy Constructor is Called" << endl << endl;
#endif
	setName(anotherMathStudent.getName());
	setID(anotherMathStudent.getID());
	setPhoneNumber(anotherMathStudent.getPhoneNumber());
	setAge(anotherMathStudent.getAge());
	setGender(anotherMathStudent.getGender());
	setClassStanding(anotherMathStudent.getClassStanding());
	setGPA(anotherMathStudent.getGPA());
	setZipCode(anotherMathStudent.getZipCode());

	setAddress(anotherMathStudent.address);
	setCity(anotherMathStudent.city);
	setState(anotherMathStudent.state);
}
示例#4
0
   void addAddress(Person* c, const QString& key, const QByteArray& fn) {
      auto addr = Person::Address();
      QList<QByteArray> fields = fn.split(VCardUtils::Delimiter::SEPARATOR_TOKEN[0]);
      QStringList keyFields = key.split(VCardUtils::Delimiter::SEPARATOR_TOKEN);

      if(keyFields.size() < 2 || fields.size() < 7) {
          qDebug() << "Malformatted Address";
          return;
      }

      addr.setType        (keyFields[1]                   );
      addr.setAddressLine (QString::fromUtf8(fields[2])   );
      addr.setCity        (QString::fromUtf8(fields[3])   );
      addr.setState       (QString::fromUtf8(fields[4])   );
      addr.setZipCode     (QString::fromUtf8(fields[5])   );
      addr.setCountry     (QString::fromUtf8(fields[6])   );

      c->addAddress(addr);
   }
示例#5
0
/******************************************************************************
 * MathStudent()
 * 	This constructor will receive a math student's full info and create a math
 * 		student object with that info
 *****************************************************************************/
MathStudent::MathStudent(string		studentName,	//The Student's Name
						int			studentId,		//The Student's ID
						long long	studentPhoneNum,//The Student's Phone Number
						int			studentAge,		//The Student's Age
						char		studentGender,	//The Student's Gender
						string		studentClass,	//The Student's Class Standing
						double		studentGPA,		//The Student's GPA
						char*		studentAddress,	//The Student's Address
						char*		studentCity,	//The Student's City
						char* 		studentState,	//The Student's State
						int			studentZipCode)	//The Student's Zip Code
: Student(studentName, studentId, studentPhoneNum, studentAge, studentGender,
				studentClass, studentGPA)
{
	#ifdef TEST
	cout << "Non-default Constructor is Called" << endl << endl;
	#endif
	setAddress(studentAddress);
	setCity(studentCity);
	setState(studentState);
	setZipCode(studentZipCode);
}
示例#6
0
/******************************************************************************
 * copyFrom()
 * 	This method receive a Math Student Object, then copy the info from that
 * 		math student object to the Math Student Object call the function
 *****************************************************************************/
void MathStudent::copyFrom(MathStudent anotherMathStudent)	//Another Math Student
{
#ifdef TEST
cout << "Copy From(deep copy) is Called" << endl << endl;
#endif
	setName(anotherMathStudent.getName());
	setID(anotherMathStudent.getID());
	setPhoneNumber(anotherMathStudent.getPhoneNumber());
	setAge(anotherMathStudent.getAge());
	setGender(anotherMathStudent.getGender());
	setClassStanding(anotherMathStudent.getClassStanding());
	setGPA(anotherMathStudent.getGPA());
	setZipCode(anotherMathStudent.getZipCode());

	delete[] address;
	delete[] city;
	delete[] state;

	setAddress(anotherMathStudent.address);
	setCity(anotherMathStudent.city);
	setState(anotherMathStudent.state);
}