Ejemplo n.º 1
0
void print_course()
{
	int cIndex;	 // Index location of target course.
	Course *tempCourse;	  // Pointer to target course object.
	
	const LinkedList &cList = master_course_list();	  //local reference to course list.
	
	if(cList.size() < 1)
	{
		cerr << "\n*** The Course List is Empty ***" << endl;
		return;
	}

	// Ask user which Course they want to see the enrollment for.
	cIndex = find_course(cList);

	// Check for error in find_course result.
	if (cIndex == -1)
		return;  // Error message already displayed in find_course()

	tempCourse = (Course*)cList[cIndex];

	// Display the Course's student list using the method designed to do just that.
	tempCourse->print_students();
}
Ejemplo n.º 2
0
void TeaCouDelete(void)
{
	Course* course;
	int Number;
	int again;
	do
	{
		system("cls");
		cin.clear();
		cin.sync();

		cout<<strTeaCD1;
		INPUT_INT_L(Number,1);
		course=data.CouSearch(Number);
		if(course==NULL)
			cout<<strTeaCDF;
		else
		{
			cout<<strTeaCDConfirm1<<course->GetName()<<strTeaCDConfirm2<<course->GetNumber();
			cout<<strTeaCDConfirm3<<course->GetCredit()<<strTeaCDConfirm4;
			int i;
			INPUT_INT_LU(i,0,1);
			if(i)
			{
				data.DelCou(Number);
				cout<<strTeaCDS;
			}
		}
		cout<<strTeaCD2;
		INPUT_INT_LU(again,0,1);
	}while(again);
	return;
}
Ejemplo n.º 3
0
void CsStudent :: study(Course &course) {

    int r1 = rand() / (RAND_MAX / (GRADE_RANGE + 1));
    int r2 = rand() / (RAND_MAX / (GRADE_RANGE + 1));

    // If Student finished course succesfully:
    if (r1 < CS_QUIT_CHANCE) {
        writeToStudentsLogFile(
                this->_id,
                course.getName(),
                this->_department,
                QUITS_COURSE);
    } else if (r2 < course.getMinimumGrade()) {
        writeToStudentsLogFile(
                this->_id,
                course.getName(),
                this->_department,
                FAILED_COURSE);
    } else {
        this->finishcourse(course);

        writeToStudentsLogFile(
                this->_id,
                course.getName(),
                this->_department,
                FINISHED_COURSE);
    }
}
Ejemplo n.º 4
0
void EditorSession::setSkeleton(Skeleton *skeleton)
{
    if (m_skeleton == skeleton) {
        return;
    }
    m_skeleton = skeleton;

    Language *language = m_language;
    if (!m_language) {
        language = m_resourceManager->languageResources().first()->language();
    }

    if (m_skeleton) {
        bool found = false;
        int resources = m_resourceManager->courseResources(language).count();
        for (int i=0; i < resources; ++i) {
            Course * course = m_resourceManager->course(language, i);
            if (course->foreignId() == m_skeleton->id()) {
                setCourse(course);
                found = true;
                break;
            }
        }
        if (!found) {
            setCourse(nullptr);
        }
    }

    emit skeletonChanged();
}
Ejemplo n.º 5
0
void EditorSession::setLanguage(Language *language)
{
    if (m_language == language) {
        return;
    }
    m_language = language;
    if (m_skeletonMode) {
        bool found = false;
        if (m_skeleton) {
            int resources = m_resourceManager->courseResources(m_language).count();
            for (int i=0; i < resources; ++i) {
                Course * course = m_resourceManager->course(m_language, i);
                if (course->foreignId() == m_skeleton->id()) {
                    setCourse(course);
                    found = true;
                    break;
                }
            }
        }
        if (!found) {
            setCourse(nullptr);
        }
    }
    else { // not skeleton mode
        if (m_resourceManager->courseResources(m_language).count() > 0) {
            setCourse(m_resourceManager->course(m_language, 0));
        }
    }
    emit languageChanged();
}
bool Student::hasCourse(const int courseId){
     for( int i=1; i<=courses.getLength(); i++ ){
          Course c;
          courses.retrieve(i,c);
          if( c.getID() == courseId ) return true;
     }
     return false;
}
Ejemplo n.º 7
0
void UdpClient::reset()
{
    Course* course = Database::instance().getEventCourse();

    location.horizontal = course->directionToNextControl(0);
    location.vertical = PI/2;
    location.position = course->controlPosition(0);
}
void ScreenOptionsManageCourses::AfterChangeRow( PlayerNumber pn )
{
	Course *pCourse = GetCourseWithFocus();
	Trail *pTrail = pCourse ? pCourse->GetTrail( GAMESTATE->m_stEdit, GAMESTATE->m_cdEdit ) : nullptr;

	GAMESTATE->m_pCurCourse.Set( pCourse );
	GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );

	ScreenOptions::AfterChangeRow( pn );
}
Ejemplo n.º 9
0
int main()
{
	Course newCourse;

	cout << "Add Categories" << endl;
	newCourse.addCategories();
	cout << "Add Assignment" << endl;
	newCourse.addAssignment();
	system("pause");
	return 0;
}
Ejemplo n.º 10
0
bool Database::doModifyCourse(const string& courseCode, const string& name,
                              const unsigned int& credit)
{
    string courseError = "Course does not exist";

    Course* course = courseRecord.search(Course(courseCode));

    if(!course) throw courseError;

    course->setName(name);
    course->setCredit(credit);
}
Ejemplo n.º 11
0
Course* CourseFiller::buildCourse(rapidjson::Value& courseJson){
	std::string department = courseJson["department"].GetString();
	std::string courseNumber = std::to_string(courseJson["courseNumber"].GetInt());
	std::string courseName = courseJson["name"].GetString();
	Course* course = new Course(department, courseNumber, courseName);

	for(rapidjson::SizeType i = 0; i < courseJson["sections"].Size(); i++){
		Section* section = CourseFiller::buildSection(courseJson["sections"][i]);
		course->addSection(section);
	}
	return course;
}
Ejemplo n.º 12
0
void QueryCourse::go()
{
    string code = getCodeFromInput();
    Course course = db.doQueryCourse(code);

    cout << endl;
    cout << "Code:   " << course.getCode() << endl;
    cout << "Name:   " << course.getName() << endl;
    cout << "Credit: " << course.getCredit() << endl;
    cout << endl;
    return;
}
Ejemplo n.º 13
0
void ModifyCourse::go()
{
    string code = getCodeFromInput();
    Course course = db.doQueryCourse(code);

    string name = getCourseNameFromInput(course.getName());
    unsigned int credit = getCourseCreditFromInput(course.getCredit());

    if(db.doModifyCourse(code, name, credit))
        cout << "Modification of course record successful" << endl << endl;

    return;
}
Ejemplo n.º 14
0
void 
add_course(LinkedList &sList, LinkedList &cList)
{
	int sIndex;			  // Index location of target student.
	int cIndex;			  // Index location of target course.
	Student *tempStudent; // Pointer to target student object.
	Course *tempCourse;	  // Pointer to target course object.
	bool test;			  // Bool variable, for testing whether student was 
						  // successfully added to a Course's List.

	// If the student list is empty, no point in continuing.
	if (sList.size() == 0)
	{
		cerr << "\n*** No Students in the List ***" << endl;
		return;
	}


	// First get the student selection.
	sIndex = find_student(sList);

	// If that student was not found, display error message and return.
	if (sIndex == -1)
	{
		cerr << "\n*** No Student of that Number in the List ***" << endl;
		return;
	}

	tempStudent = (Student*)sList[sIndex];
	
	// Get the course selection.
	cIndex = find_course(cList);

	// If that course was not found, return.
	if (cIndex == -1)
		return;
	
	tempCourse = (Course*)cList[cIndex];

	// Since everything is okay, add the course to the student's personal list
	tempStudent->add_course(tempCourse);

	// Now add the student to the Course's List of Students
	test = tempCourse->add_student(tempStudent);

	// Error checking.
	if (test)
		cout << "\nEnrollment for this Course updated successfully" << endl;
	else
		cerr << "\n*** Update of Enrollment for this course failed ***" << endl;
}
Ejemplo n.º 15
0
void 
remove_student()
{
	int indexValue;  // Index location of student to be removed.
	bool test;		 // Test variable for removal of students from course lists.
	
	Student *tempStudent;  // Points to any student object
	Course *tempCourse;	   // Points to any course object
	LinkedList &sList = master_student_list();  // reference to master student list.
	LinkedList &cList = master_course_list();   // reference to master course list. 

	if (sList.size() <= 0)  // Attempts to acces an empty list may cause crashes.
	{
		cerr << "\n*** The List is Empty ***" << endl;
		return;
	}

	// Ask the user for a student number and search for that student.
	indexValue = find_student(sList);

	if (indexValue == -1)  // ie. if the student was not found!
	{
		cerr << "\n*** No Student of that Number in the List ***" << endl;
		return;
	}

	// If the student WAS found then do the following.
	
	// Remove student from the list and get a pointer to the student object.
	tempStudent = (Student*)sList.remove(indexValue);
	
	// Remove this student from all course lists.
	for (int i = 0; i < cList.size(); i++)
	{
		tempCourse = (Course*)cList[i];

		// Remove the Student from the Course's List of Students
		// Note that remove_student checks if the student is in a particular
		// course before doing anything.
		test = tempCourse->remove_student(tempStudent);
	}

	// Now that the course lists have been cleaned up we can delete the student.
	delete tempStudent;
		
	//  NO NEED to fill in the empty space created by shifting values "up".
	//  Since this is a linked list the objects are not placed sequentially
	//  in memory.  The remove function just rearranges the links so that the 
	//  object removed is no longer part of the link.
}
Ejemplo n.º 16
0
void UnitTests::TestID_3()
{
    // OK Test
    Course c;
    QFile f("course/datastructures.csv");
    if(f.open(QIODevice::ReadOnly)){
        while(!f.atEnd()){
            QString line = f.readLine();
            //cout << line.toStdString() << endl;
            c = LoadCourse(line);
        }
    }
    f.close();

    QVector<QString> prereqs = c.getPrerequisites();

    QCOMPARE(c.getDepartment(),QString("CS"));
    QCOMPARE(c.getNumber(),153);
    QCOMPARE(c.getName(),QString("Data Structures"));
    QCOMPARE(c.getHours(),3);
    QCOMPARE(c.getSemester(),QString("FS"));
    QCOMPARE(c.getIsRequired(),true);
    QCOMPARE(prereqs.size(),1);
    QCOMPARE(prereqs.at(0),QString("CS53"));

}
Ejemplo n.º 17
0
bool CourseFiller::fill(CourseStore* store){
	CourseStoreDB db("104.236.4.226", "/lookup/CS", "7819");
	std::string* jsonString = db.getJson();
	rapidjson::Document doc;
	doc.Parse(jsonString->c_str());
	for (rapidjson::SizeType i = 0; i < doc.Size(); i++){
		Course* course = CourseFiller::buildCourse(doc[i]);
		std::string name = course->getDepartment() + course->getCourseNumber();
		course->getCombos();
		store->insert(name, course);
	}
	delete jsonString;
	return true;
}
Ejemplo n.º 18
0
void UnderGradAppPage::fillInTA(WindowApp* theApp) {
    if(theApp->uGradAppPage->form->rTA || theApp->editUApp->rTA) {
        theApp->uGradAppPage->relatedTA = new Queue<Course>(*(theApp->editUApp->relatedTAPositions));
        cout<<theApp->uGradAppPage->relatedTA->size() <<endl;
        Course *course = theApp->uGradAppPage->relatedTA->popFront();
        stringstream ss;
        ss << course->getYear();
        string year = ss.str();

        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_year2), year.c_str());
        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_relatedCourse2), course->getTitle().c_str());
        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_term2), course->getTerm().c_str());
        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_supervisor), course->getSupervisor().c_str());
    }
}
Ejemplo n.º 19
0
	void Registrar::cancelCourse(const std::string& courseName) {
        Course* course = nullptr;

        for (size_t i = 0; i < courses.size(); i++) {
            if (courses[i]->getName() == courseName) {
                course = courses[i];
            }
        }

        if (course != nullptr) {
            course->dropStudents();
        } else {
            cerr << "Unable to find course when cancelling course" << endl;
        }
	}
Ejemplo n.º 20
0
		void Registrar::cancelCourse(const std::string &course_name){
			int course_index = find_course_index_by_name(course_name);

			if (course_index > -1){
				Course* course = courses[course_index];

				//Remove all references to user in course vector
				course->clear_students();

				courses.erase(courses.begin() + course_index);
			}



		}
void StudentWeigthSystemEngine::AddCourse()
{
	cout << "Enter course id: ";
	string courseId;
	cin >> courseId;
	Course *course = new Course(courseId);
	int studentsCount = 0;
	this->courses.push_back(course);
	cout << "Students count: ";
	cin >> studentsCount;
	for (int i = 1; i <= studentsCount; i++)
	{
		course->AddStudent(this->IntializeStudent());
	}
}
Ejemplo n.º 22
0
void UnderGradAppPage::fillInRelated(WindowApp* theApp) {
    if(theApp->uGradAppPage->form->rCourses || theApp->editUApp->rCourses) { //this will check if the queue exists
        theApp->uGradAppPage->relatedCourse = new Queue<Course>(*(theApp->editUApp->relatedCourses));
        cout<<theApp->uGradAppPage->relatedCourse->size() <<endl;
        Course *course = theApp->uGradAppPage->relatedCourse->popFront();
        stringstream ss;
        ss << course->getYear();
        string year = ss.str();

        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_year1), year.c_str());
        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_relatedCourse1), course->getTitle().c_str());
        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_term1), course->getTerm().c_str());
        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_finalGrade), course->getFinal().c_str());
    }
}
Ejemplo n.º 23
0
// administrator adds a course
bool Administrator::AddCourse(const Course &c) const
{
    /*insert a record into the course table*/

    QSqlQuery query;
    query.prepare("insert into Course (courseID, title, deptName, credits) values (?, ?, ? ,?)");
    query.addBindValue(c.GetCourseID());
    query.addBindValue(c.GetTitle().data());
    query.addBindValue(c.GetDeptName().data());
    query.addBindValue(c.GetCredits());

    if(!query.exec())
        return false;

    return true;
}
// Prints all the information about the student object
void Student::print(){
     cout << ID << "\t\t" << firstname << "\t\t" << lastname << endl;
     
     if( courses.getLength() == 0 ){
     }else
     {
          cout << endl << "\tEnrolled Courses: " << endl;
          cout << "\tCourse ID\tCourse Name\n";
          for( int i=1; i<=courses.getLength(); i++ ){
               Course c;
               courses.retrieve(i,c);
               c.print();
          }
          cout << endl << endl;
     }
}
Ejemplo n.º 25
0
CString OptionRow::GetRowTitle() const
{
	CString sLineName = m_RowDef.name;
	CString sTitle = THEME_TITLES ? OPTION_TITLE(sLineName) : sLineName;

	// HACK: tack the BPM onto the name of the speed line
	if( sLineName.CompareNoCase("speed")==0 )
	{
		bool bShowBpmInSpeedTitle = SHOW_BPM_IN_SPEED_TITLE;

		if( GAMESTATE->m_pCurCourse )
		{
			Trail* pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber];
			ASSERT( pTrail != NULL );
			const int iNumCourseEntries = pTrail->m_vEntries.size();
			if( iNumCourseEntries > MAX_COURSE_ENTRIES_BEFORE_VARIOUS )
				bShowBpmInSpeedTitle = false;
		}

		if( bShowBpmInSpeedTitle )
		{
			DisplayBpms bpms;
			if( GAMESTATE->m_pCurSong )
			{
				Song* pSong = GAMESTATE->m_pCurSong;
				pSong->GetDisplayBpms( bpms );
			}
			else if( GAMESTATE->m_pCurCourse )
			{
				Course *pCourse = GAMESTATE->m_pCurCourse;
				StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
				Trail* pTrail = pCourse->GetTrail( st );
				ASSERT( pTrail );
				pTrail->GetDisplayBpms( bpms );
			}

			if( bpms.IsSecret() )
				sTitle += ssprintf( " (??" "?)" ); /* split so gcc doesn't think this is a trigraph */
			else if( bpms.BpmIsConstant() )
				sTitle += ssprintf( " (%.0f)", bpms.GetMin() );
			else
				sTitle += ssprintf( " (%.0f-%.0f)", bpms.GetMin(), bpms.GetMax() );
		}
	}

	return sTitle;
}
Ejemplo n.º 26
0
		void Registrar::enrollStudentInCourse(std::string user_name, std::string course_name){
			int user_index = find_user_index_by_name(user_name);
			int course_index = find_course_index_by_name(course_name);

			
			if (user_index > -1 && course_index > -1){
				User* user = students[user_index];
				Course* course = courses[course_index];

				course->add_student(user);
				user->add_course(course);
			}
			else{
				std::cout << "could not find user or course: " + user_name + ", " + course_name << std::endl;
			}

		}
Ejemplo n.º 27
0
void UnderGradAppPage::editNextRelated(WindowApp *theApp) {
    if(!theApp->uGradAppPage->relatedTA->isEmpty()) {

        Course *course = theApp->uGradAppPage->relatedTA->popFront();
        stringstream ss;
        ss << course->getYear();
        string year = ss.str();

        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_year2), year.c_str());
        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_relatedCourse2), course->getTitle().c_str());
        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_term2), course->getTerm().c_str());
        gtk_entry_set_text(GTK_ENTRY(theApp->uGradAppPage->form->ei_supervisor), course->getSupervisor().c_str());
    }
    else {
        cout << "thing is empty?" << endl;
    }
}
Ejemplo n.º 28
0
void 
print_list()
{
	int i;
	const LinkedList &sList = master_student_list();  //local reference to student list.
	const LinkedList &cList = master_course_list();	  //local reference to course list.
	Student *studentPtr;  // local pointer to student object
	Course *coursePtr;	  // local pointer to course object
	
	if (sList.size() <= 0)  // Attempts to acces an empty list are avoided.
		cerr << "\n*** No Students in the List ***\n" << endl;
		
	if (sList.size() > 0)
	{
		cout << "\nSTUDENTS CURRENTLY IN THE DATABASE" << endl;
		// Print out the student objects.
		for (i = 0; i < sList.size(); i++)
		{
			// Get a student object from the list
			studentPtr = (Student*)sList[i]; // uses operator overloading for '[]'
	
			// Now print the student using the print behaviour of the student object.
			studentPtr->print();
		}
	}

	if (cList.size() <= 0)  // Attempts to acces an empty list are avoided.
		cerr << "\n*** No Courses in the List ***" << endl;

	if (cList.size() > 0)
	{
		cout << "ENROLLMENT FOR ALL COURSES IN THE DATABASE\n" << endl;
		// Print out the course objects.
		for (i = 0; i < cList.size(); i++)
		{
			// Get a course object from the list
			coursePtr = (Course*)cList[i];

			// Now print the course using the print behaviour of the course object.
			coursePtr->print();
		}
	}
}
Ejemplo n.º 29
0
void PGStudent::study(Course& c) {
    if (rand()%101 < 20) {
        // student is slacking off the course.
        Utils::log(_id, " is slacking off ", c.getName());
        return;  
    } 
    
    // the student handled the workload during the semester, now
    // he should try his luck at the exam.
    takeExam(c);
}
Ejemplo n.º 30
0
void CSStudent::study(Course& c) {
    if (rand()%101 < 25) {
        // student didn't handle the workload and quit the course.
        Utils::log(_id, " quits course ", c.getName());
        return;  
    } 
    
    // the student handled the workload during the semester, now
    // he should try his luck at the exam.
    takeExam(c);
}