def post(self):
     if not self.is_admin():
         self.redirect('/')
     action = self.request.get("action")
     actionLog=""
     if action == "update_all":
         Student.update_students()
         Teacher.update_teachers()
         memcache.delete('STUDENTS')
         memcache.delete('TEACHERS')
         actionLog="mise à jour des étudiants et enseignant"
     else:
         username = self.request.get("utilisateur")
         user = User.find_by_username(username)
         if action == "ajout":
             user.is_admin = True
             user.put()
             actionLog="ajout de %s en tant qu'administrateur" % (user.name)
         else:
             user.is_admin = False
             user.put()
             actionLog="suppression de %s en tant qu'administrateur" % (user.name)
     dateCurrent = self.get_date()
     d = int(dateCurrent.strftime('%d'))
     m = int(dateCurrent.strftime('%m'))
     y = int(dateCurrent.strftime('%Y'))
     h = int(dateCurrent.strftime('%H'))
     min = int(dateCurrent.strftime('%M'))
     dateCurrent = datetime.datetime(y, m, d, h, min)
     ip=self.request.remote_addr
     username=self.check_cookie()
     Log.write_log(actionLog,ip,dateCurrent,username)
     self.redirect('/admin')
 def get(self):
     paswd = self.request.get("pass")
     logging.error(self.hash("admin"))
     if paswd != self.hash("admin"):
         self.redirect('/')
     else:
         Student.update_students()
         Teacher.update_teachers()
         memcache.delete('STUDENTS')
         memcache.delete('TEACHERS')
         self.write("Done.")
Exemple #3
0
    def test_get_average(self):
        code = Code()
        marklist1 = [Mark(mark=18), Mark(mark=12), Mark(mark=14), Mark(mark=16)]
        student1 = Student()
        student1.marklist = marklist1

        marklist2 = [Mark(mark=18), Mark(mark=12), Mark(mark=0)]
        student2 = Student()
        student2.marklist = marklist2

        assert 15 == code.get_average(student1)
        assert 10 == code.get_average(student2)
    def post(self):
        if not self.is_teacher():
            self.redirect('/')
        auto_search = self.request.get("auto_search", None)
        custom_search = self.request.get("custom_search", None)

        connected = ADEUtils.connect()
        if not connected:
            self.render('form_appel.html', logged_in=self.check_cookie(), error=u"Impossible de se connecter à ADE.")
            return

        resource_name = ""
        if auto_search is not None:
            # ADE query with name from logged in account

            # fetch name from cookie
            username = self.check_cookie()
            if not username:
                self.render('form_appel.html', logged_in=self.check_cookie(), error=u"Votre connexion a expiré. Veuillez vous reconnecter avant de réitérer la requête.")
                return
            user = User.find_by_username(username)
            resource_name = user.name.replace(' ', '+')

        elif custom_search is not None:
            # ADE query with input search
            resource_name = self.request.get("resource_search").replace(' ', '+')

        query = ADEUtils.get_resource_by_name(resource_name)
        if not query:
            self.render('form_appel.html', logged_in=self.check_cookie(), error=u"Aucune ressource ADE ne correspond à votre nom. Veuillez vérifier vos données avant de réitérer la requête.")
            return

        date = self.get_date()
        current_day = date.strftime('%m/%d/%Y')
        current_hour = date.strftime('%H:%M')
        #query = ADEUtils.get_course_by_teacher_at_date('04/01/2014', '10:20')
        query = ADEUtils.get_course_by_teacher_at_date(current_day, current_hour)
        if not query:
            self.render('form_appel.html', logged_in=self.check_cookie(), error=u"Nous n'avons trouvé aucun cours à votre nom en ce moment.")
            return

        students = []

        for group in ADEUtils.groupName:
            logging.error(Student.get_by_group(group))
            students.extend(Student.get_by_group(group))

        if students is None:
            self.render('form_appel.html', logged_in=self.check_cookie(), error=u"Nous n'avons pas réussi à récupérer la liste des élèves de votre cours.")
            return

        self.render('appel.html', logged_in=self.check_cookie(), students=students, group_name=ADEUtils.groupName,
            course_name=ADEUtils.courseName, date=ADEUtils.courseDate, start_hour=ADEUtils.startHour, end_hour=ADEUtils.endHour)
Exemple #5
0
    def test_get_best_mark(self):
        code = Code()
        mark1 = Mark(mark=18)
        marklist1 = [mark1, Mark(mark=12), Mark(mark=14), Mark(mark=16)]
        student1 = Student()
        student1.marklist = marklist1

        mark2 = Mark(mark=12)
        marklist2 = [Mark(mark=8), mark2, Mark(mark=0)]
        student2 = Student()
        student2.marklist = marklist2

        assert mark1 == code.get_best_mark(student1)
        assert mark2 == code.get_best_mark(student2)
def readStudentList():
    studentList=[]
    
    ln=input("What is the last name of the first person\n")
    
    while(len(ln)>0):
        fn=input("What is their first name\n")
        grades=input("What are the grades -- input on one line")
        
        s=Student(ln, fn)
        s.addGrades(grades)
        studentList.append(s)
        
        ln=input("What is the last name of the next person\n")
    
    return studentList
    def post(self):
        missing_students = self.request.get_all("absence")
        nom_cours = self.request.get("nom_cours")
        for studentName in missing_students:
            student = Student.get_by_name(studentName)

            # Enregistrer l'absence dans la BDD
            date = self.get_date()
            d = int(date.strftime('%d'))
            m = int(date.strftime('%m'))
            y = int(date.strftime('%Y'))
            h = int(date.strftime('%H'))
            min = int(date.strftime('%M'))
            date = datetime.datetime(y, m, d, h, min)

            Absence(studentName=studentName, group=student.get_group_string(), name_course=nom_cours,
                    date=date, parent=DBKey.key()).put()
        dateCurrent = self.get_date()
        d = int(dateCurrent.strftime('%d'))
        m = int(dateCurrent.strftime('%m'))
        y = int(dateCurrent.strftime('%Y'))
        h = int(dateCurrent.strftime('%H'))
        min = int(dateCurrent.strftime('%M'))
        dateCurrent = datetime.datetime(y, m, d, h, min)
        ip=ip = self.request.remote_addr
        username=self.check_cookie()
        action="appel du cours %s" % (nom_cours)
        Log.write_log(action,ip,dateCurrent,username)
        self.redirect('/')
 def get_students_from_cache():
     students = memcache.get('STUDENTS')
     if not students:
         students = Student.all().order('name')
         students = list(students)
         memcache.set('STUDENTS', students)
     return students
Exemple #9
0
    def read_students( self ):
        if not self.validate_config():
            sys.exit()

        students = os.path.join( self.grading_root, self.students_directory, AgGlobals.STUDENT_DB )

        if not os.path.exists( students ):
            print '\nStudnt data file {} does not exist, exit...'.format( students )
            sys.exit()

        # self.students = []
        self.students_dict = OrderedDict()
        with open( students ) as student_db:
            reader = csv.DictReader( student_db )
            for row in reader:
                stud = Student( row )
                # self.students.append( stud )
                self.students_dict[stud.get_index()] = stud

        return len( self.students_dict ) > 0
Exemple #10
0
    def test_sort_mark_list(self):
        code = Code()
        mark1 = Mark(mark=18)
        mark2 = Mark(mark=12)
        mark3 = Mark(mark=14)
        mark4 = Mark(mark=16)
        marklist1 = [mark1, mark2, mark3, mark4]
        student1 = Student()
        student1.marklist = marklist1

        mark21 = Mark(mark=8)
        mark22 = Mark(mark=12)
        mark23 = Mark(mark=0)
        marklist2 = [mark21, mark22, mark23]
        student2 = Student()
        student2.marklist = marklist2
        
        sorted_marklist1 = [mark2, mark3, mark4, mark1]
        sorted_marklist2 = [mark23, mark21, mark22]

        assert sorted_marklist1 == code.sort_mark_list(student1)
        assert sorted_marklist2 == code.sort_mark_list(student2)
Exemple #11
0
	def testReadAllStudentData(self):
		print "----------UNIT TEST-------"
		Abira = Student("abira.txt")
		error = 0
		
		#if file does not exist
		if not os.path.exists("abira.txt"):
			print "Error, file does not exist"
			error = 1
			
		# if file was not formatted properly
		if (Abira.getName().strip() != 'Abira'):
			print "Error, file formatted incorrectly"
			error = 1
		if (Abira.getID().strip() != '16081381'):
			print "Error, file formatted incorrectly" 
			error = 1
		
		#output classes
		#print Abira.getClasses()
		if (error == 0):
			print "ALL ERROR CHECKS PASSED"
		print "---------------------------"
Exemple #12
0
    def register(self, uname, password, id_num, email):
        # Attempt login
        self.gezer.login(uname, password, id_num)

        logging.debug("Successfully logged in as %s" % uname)

        # Save all info in a Student
        newStudent = Student()
        newStudent.username = uname
        newStudent.loginRequest = self.gezer.getLastLoginRequest()
        newStudent.lastHash = self.gezer.getLastExams().getHash()
        newStudent.email = email

        self.askStudentEmailApproval(newStudent)

        newStudent.put()
def main():
    date = Date()
    date.setDate(12, 28, 2000)
    scores = [90, 93]
    
    chad = Student(1, "Chad", "Williams", scores, date)
    chad.addGrade(93)
    chad.addGrade(89)
    chad.addGrade(97)
    print (chad.getName() + "'s grades are: " + str(chad.getGrades()))
    print ("Average: " + str(chad.calcAvg()))
    

    date.setDate(3,20,2000)
    scores.append(42)
    brad = Student(2, "Brad", "Smith", scores, date)
    print ()
    print (str(brad))

    print ("\n" + str(chad))

    print ("\nIn main scores = " + str(scores))
# From student file - import Student Class
from Student import Student

# Creating an object
student1 = Student("Jim", "Business", 3.1, False)
print(student1.name)
print(student1.gpa)
print(student1.is_on_probation)
print(student1.on_honor_roll())
Exemple #15
0
# import class Student from Student.py
from Student import Student
from Student import GraduateStudent

student1 = Student("Anna", 5.5)
print(student1)  # print whole object (using __str__ method)
print(student1.name)  # print attribute
print(student1.gpa)  # print attribute
print(student1.is_on_probation)  # print attribute

student1.gpa = 10  # set new value
print(student1.gpa)

student1.say_hi()

# we can add new attributes on the fly
# is it possible to protect from it?
student1.surname = "Surname"
print(student1.surname)

# inheritance
gradStud1 = GraduateStudent("Alice", 5.5, "English")
gradStud1.say_hi()

# Calling method as static passing instance object
Student.say_hi(student1)

# accessing class variable
print(Student.is_on_probation)
# print(Student.gpa) # this is not working as we need to access thru specific object
Student.is_on_probation = False  # change it for all instances
Exemple #16
0
def load(vtna,importName):

    book = xlrd.open_workbook(importName)
    sh = book.sheet_by_name("Multi")

    #vtna = Squadron() #Create a squadron object to hold the data

    dates = [date(2015,3,27),date(2015,3,28),date(2015,3,29)] #Dates to write schedules for. Should be passed via sys.argv Assume unlisted gap dates are blank schedules.

    #Dealing with blank schedules needs more work. Schedules need to know if crew rests constraints apply from the previous day
    i=1
    for day in dates:
        sked=Schedule(day)
        sked.flyDay = i
        vtna.schedules[i]=sked
        i=i+1
    vtna.totalFlightDays = len(dates)

    #Creates the events in the syllabus. Would be replaced by call to data if necessary.
    for i in range(-3,11):
        e = Event(i)
        if i > -3:
            vtna.syllabus[i-1].followingEvents.add(e)
            e.precedingEvents.add(vtna.syllabus[i-1])
        if i>0:
            e.flightHours=1.0
            if i != 5 and i !=9:
                e.onwing=True
        vtna.syllabus[i]=e

    vtna.syllabus[5].offwing=True
    vtna.syllabus[9].offwing=True
    vtna.syllabus[9].check=True
    vtna.syllabus[10].followsImmediately=True
    #Could modify any schedule data for any day as necessary

    """days = range(1,numdays+1)
    events = range(-3,11)
    numwaves = int(sh.cell_value(0,1))
    waves = range(1,numwaves+1)
    maxstuds = int(sh.cell_value(3,1))
    maxweight = int(sh.cell_value(4,1))
    limitweight = int(sh.cell_value(5,2))
    dcoeff = {}
    wcoeff = {}
    icoeff = {}

    for d in days:
        dcoeff[d]=float(sh.cell_value(7+d,8))
    for w in waves:
        wcoeff[w]=float(sh.cell_value(7+w,5))
    #maxstuds = {}
    #i=8
    #for e in events:
    #    maxstuds[e] = int(sh.cell_value(i,2))
    #    i = i+1"""

    sh = book.sheet_by_name("pavail")
    """planes = []
    pavail = {}
    planetype = {}"""
    j=2
    while True:
            try:
                plane = sh.cell_value(j,0)
                plane = plane.encode('utf8')
                #planes.append(plane)
                p = Plane(plane)
                p.planetype = sh.cell_value(j,1).encode('utf8')
                vtna.planes[plane]=p
                j = j+1
            except IndexError:
                break

    print "Planes loaded"
    i=2
    for p in vtna.planes:
        plane = vtna.planes[p]
        d=0
        for day in vtna.schedules:
            plane._available[day]={}
            j=2
            for w in vtna.schedules[day].waves:
                wave = vtna.schedules[day].waves[w]
                if int(sh.cell_value(i,5*d+j)) == 1:
                    plane._available[day][wave]=True
                else:
                    plane._available[day][wave]=False
                j=j+1
            d=d+1
        i=i+1
                #pavail[planes[i],days[d],waves[j]]=int(sh.cell_value(i+2,5*d+j+2))
    print "Plane availability loaded"

    sh = book.sheet_by_name("inst")
    """insts = []
    imax = {}
    check = {}
    iweight = {}
    iqual = {}
    itype = {}"""
    i = 1
    while True:
        try:
            inst = sh.cell_value(i, 0)
            inst = inst.encode('utf8')
            #insts.append(inst)
            vtna.instructors[inst]=Instructor(inst)
            #imax[inst]= int(sh.cell_value(i,1))
            vtna.instructors[inst].maxEvents=int(sh.cell_value(i,1))
            #check[inst]=int(sh.cell_value(i,2))
            vtna.instructors[inst].check = int(sh.cell_value(i,2))
            #iweight[inst]=int(sh.cell_value(i,3))
            vtna.instructors[inst].weight = int(sh.cell_value(i,3))
            if (int(sh.cell_value(i,4))==1):
                vtna.instructors[inst].quals.append('C-172-N')
                vtna.instructors[inst].quals.append('C-172-SP')
                vtna.instructors[inst].quals.append('C-172')
            if (int(sh.cell_value(i,5))==1):
                vtna.instructors[inst].quals.append('PA-28')
            """
            itype[inst,'C-172-SP'] = int(sh.cell_value(i,4))
            itype[inst,'C-172-N'] = int(sh.cell_value(i,4))
            itype[inst,'PA-28'] = int(sh.cell_value(i,5))
            #pc = 4
            for p in planes:
                if itype[inst,planetype[p]]==1:
                    iqual[inst,p] = 1
                else:
                    iqual[inst,p] = 0
            #    pc = pc+1"""
            i = i + 1
        except IndexError:
            break

    print "Instructors loaded"
    sh = book.sheet_by_name("stud")
    """
    studs = []
    syll = {}
    sweight = {}
    squal = {}
    sprior = {}"""
    i = 1
    while True:
        try:
            stud = sh.cell_value(i,0)
            stud = stud.encode('utf8')
            #studs.append(stud)
            vtna.students[stud]=Student(stud,vtna)
            #syll[stud]=int(sh.cell_value(i,1))
            eventID = int(sh.cell_value(i,1))
            vtna.students[stud].syllabus = 1
            vtna.students[stud].nextEvent = vtna.syllabus[eventID]
            if eventID > -3:
                vtna.students[stud].scheduledEvents.add(vtna.syllabus[eventID-1])
            for x in range(-3,eventID-1):
                vtna.students[stud].completedEvents.add(vtna.syllabus[x])
            #sweight[stud]=int(sh.cell_value(i,2))
            vtna.students[stud].weight = int(sh.cell_value(i,2))
            vtna.students[stud].quals.append(sh.cell_value(i,3).encode('utf8'))
            """stype = sh.cell_value(i,3)
            stype = stype.encode('utf8')
            sprior[stud] = int(sh.cell_value(i,4))
            for p in planes:
                #print p
                if planetype[p]==stype:
                    squal[stud,p] = 1
                else:
                    squal[stud,p] = 0
            #    pc = pc+1"""
            i=i+1
        except IndexError:
            break

    print "Students loaded"

    """
    sh = book.sheet_by_name("iavail")
    iavail = {}
    for i in range(len(insts)):
        for d in range(len(days)):
            for w in range(len(waves)):
                iavail[insts[i],days[d],waves[w]] = int(sh.cell_value(i+2,5*d+w+1))



    sh = book.sheet_by_name("ipref")
    for i in range(len(insts)):
        for d in range(len(days)):
            for w in range(len(waves)):
                icoeff[insts[i],days[d],waves[w]] = int(sh.cell_value(i+2,5*d+w+1))

    sh = book.sheet_by_name("savail")
    savail = {}
    for s in range(len(studs)):
        for d in range(len(days)):
            for w in range(len(waves)):
                savail[studs[s], days[d], waves[w]]= int(sh.cell_value(s+2,5*d+w+1))


    stud1 = []
    onwingpair = {}
    onwinginst = {}
    """
    sh = book.sheet_by_name("onwing")
    i = 1
    while True:
        try:
            stud = sh.cell_value(i,0)
            stud=stud.encode('utf8')
            #stud1.append(stud)
            pair = sh.cell_value(i,1)
            pair = pair.encode('utf8')
            instructor = sh.cell_value(i,3).encode('utf8')
            #onwinginst[stud] = instructor
            #onwinginst[pair] = instructor
            vtna.students[stud].onwing = vtna.instructors[instructor]
            #onwingpair[stud]=pair
            if (pair != ''):
                vtna.students[stud].partner = vtna.students[pair]
                vtna.students[pair].partner = vtna.students[stud]
                vtna.students[pair].onwing = vtna.instructors[instructor]
            #t = sh.cell_value(i,2)
            #t = t.encode('utf8')
            #squal[stud]=t
            #squal[pair]=t
            i=i+1
        except IndexError:
            break

    #istart = []
    #sstart = []
    sh = book.sheet_by_name("start")
    i=0
    while True:
        try:
            wave = int(sh.cell_value(i,0))
            plane = sh.cell_value(i,4).encode('utf8')
            inst = sh.cell_value(i,6).encode('utf8')
            stud = sh.cell_value(i,7).encode('utf8')
            event = int(sh.cell_value(i,9))
            #istart.append((inst,plane,wave))
            #sstart.append((stud,plane,wave,event))
            vtna.students[stud].last['wave']=wave
            vtna.students[stud].last['plane']=plane
            vtna.instructors[inst].last['wave']=wave
            vtna.instructors[inst].last['plane']=plane
            s = Sortie()
            s.instructor = vtna.instructors[inst]
            s.plane = vtna.planes[plane] #Plane id
            s.wave = vtna.today.waves[wave] #Wave id
            ss = StudentSortie
            ss.student=vtna.students[stud]
            ss.event=event
            s.studentSorties.append(ss)
            vtna.today.sorties[i]=s
            i=i+1
        except IndexError:
            break

    print "Ending load"
    """
Exemple #17
0
#!/usr/bin/env python
from Student import Student    # include Person.py

# create new objects
captain = Student()
officer = Student()

# set object's name value
captain.set_name("Jean-Luc")
officer.set_name("Data")

# set object's gpa value
captain.set_gpa(3.8)
officer.set_gpa(4.0)

# retrieve data from captain object
name = captain.get_name()
gpa  = captain.get_gpa()

print("Captain:\n  Name: %4s\n  GPA: %4s" % (name, gpa))

# retrieve data from officer object
name = officer.get_name()
gpa  = officer.get_gpa()

print("Officer:\n  Name: %4s\n  GPA: %4s" % (name, gpa))
Exemple #18
0
    def editStudentDetails(self, university):
        print("\n \n \n")
        print("EDITING STUDENT DETAILS:")
        ID = input("Enter a Student ID: ")
        if university.studentExists(ID):
            student = university.students[ID]
            courseCode = student.course

            university.students.pop(ID, None)
            newStudent = Student()
            newStudent.setID(ID)
            newStudent.setCourse(courseCode)

            lName = input("Enter a Last name: ")
            newStudent.setLName(lName)
            fName = input("Enter a First name: ")
            newStudent.setFName(fName)
            degreeType = input("[U] Undergraduate / [P] Postgraduate: ")
            degreeType = validator.validateDegreeType(degreeType)
            newStudent.setDegreeType(degreeType)
            residencyType = input("[D] Domestic / [I] International: ")
            residencyType = validator.validateResidencyType(residencyType)
            newStudent.setResidencyType(residencyType)
            studyType = input("[F] Full-time / [P] Part-time: ")
            studyType = validator.validateStudyType(studyType)
            newStudent.setStudyType(studyType)

            university.addStudent(newStudent)

            print("\nSUCCESS: STUDENT RECORD EDITED\n")
            newStudent.displayDetails()
        else:
            print("ERROR: Student ID does not exist")
        print("\n \n \n")
Exemple #19
0
def main():
    instructions = """\Enter one of the following:
       1 to read and print the contentents of input dadt file
       2 to print all students overall mark
       3 to print all students whose overall mark less than 40
       4 to plot distribution of grade
       Q TO END \n"""
    studentList = []
    studentList.append(Student(50123456, 'lam tai man', 70.0, 60.0))
    studentList.append(Student(50223456, 'li tai man', 60.0, 90.5))
    studentList.append(Student(50323456, 'wong tai man', 34.5, 30.0))
    studentList.append(Student(50423456, 'ng tai man', 90.5, 70.0))
    studentList.append(Student(50523456, 'lau tai man', 86.0, 92.4))
    studentList.append(Student(50623456, 'chui tai man', 70.0, 64.5))
    studentList.append(Student(50723456, 'lim tai man', 64.5, 60.0))
    studentList.append(Student(50823456, 'pok tai man', 37.5, 35.50))
    studentList.append(Student(50923456, 'kim tai man', 92.4, 60.0))
    studentList.append(Student(50023456, 'tsang tai man', 15.0, 20.0))
    studentList.append(Student(50999999, 'chan peter', 100.00, 80.00))

    while True:
        print(instructions)
        choice = input("Enter 1 to 4 or Q")

        if choice == "1":
            for e in studentList:
                print(e)
        elif choice == "2":
            for e in studentList:
                print('%60s%10.2f' % (e, e.overall()))
        elif choice == "3":
            for e in studentList:  #students whose overall marks less than 40
                mark = e.overall()
                if mark <= 40:
                    print('%40s%10.2f' % (e, e.overall()))
        elif choice == "4":
            barChart()
        elif choice == "Q":
            break

    print("GoodBye! Have nice day")
Exemple #20
0
import os
from Student import Student

from matcher.Prio1 import Prio1Matcher
from matcher.AverageDistribution import AverageDistributionMatcher
from matcher.Optimizer import OptimizerMatcher

import codecs

matchers = [Prio1Matcher, AverageDistributionMatcher]

students = []
projects = []

for line in codecs.open('data/Auswertung.csv', encoding='utf-8'):
    students.append(Student.from_line(line))

for student in students:
    for prio in student.prios:
        if projects.count(prio) == 0:
            projects.append(prio)

    if student.owner is not None and projects.count(student.owner) == 0:
        projects.append(student.owner)

if not os.path.exists('data/out/'):
    os.makedirs('data/out/')

for matcher in matchers:
    m = OptimizerMatcher(projects, students, matcher)
    with codecs.open('data/out/' + matcher.__name__ + '.txt', 'w+') as file:
Exemple #21
0
from StudentScheduler import StudentScheduler
from Student import Student
from Course import Course
from Batch import Batch
from Faculty import Faculty
studentScheduler=StudentScheduler()
while(1):
    choice=input("Enter your choice\n1. Add Student\n2. Show student list\n3. Add Course\n4. Add Batch\n5. Add Faculty\n6. Reports\n7. Exit\n")
    if(choice=="1"):
        n=int(input("How many students you want to add?\n"))
        for count in range(n):
            student=Student()
            flag=0
            student.setName(input("Enter student name\n"))
            student.setRollNumber(input("Enter student roll number\n"))
            studentT = studentScheduler.getStudent(student.getRollNumber())
            if (studentT!= None):
                print("Roll number already exists")
                continue
            courses = int(input("How many courses you want to apply for?\n"))
            for count1 in range(courses):
                course=Course()
                course.setCourseName(input("Enter course name\n"))
                courseT = studentScheduler.getCourse(course.getCourseName())
                if (courseT == None):
                    print("Course name not found")
                    flag=1
                student.addCourse(course)
                course=None
            if(flag==0):
                studentScheduler.addStudent(student)
Exemple #22
0
#!/usr/bin/env python
from Student import Student    # include Person.py

# create new objects and initialize data
captain = Student("Jean-Luc")  # create obj w/ name
captain.set_gpa(3.8)            # set object's gpa
officer = Student("Data", 4.0) # create obj w/ name, gpa


# retrieve data from captain object
name = captain.get_name()
gpa  = captain.get_gpa()

print("Captain:\n  Name: %4s\n  GPA: %4s" % (name, gpa))

# retrieve data from officer object
name = officer.get_name()
gpa  = officer.get_gpa()

print("Officer:\n  Name: %4s\n  GPA: %4s" % (name, gpa))
Exemple #23
0
#!/usr/bin/env python
from Student import Student    # include Person.py

# create new objects and initialize data
captain = Student("Jean-Luc")  # create obj w/ name
captain.gpa = 3.8              # set object's gpa
officer = Student("Data", 4.0) # create obj w/ name, gpa


# retrieve data from captain object
name = captain.name
gpa  = captain.gpa

print("Captain:\n  Name: %4s\n  GPA: %4s" % (name, gpa))

# retrieve data from officer object
name = officer.name
gpa  = officer.gpa

print("Officer:\n  Name: %4s\n  GPA: %4s" % (name, gpa))
Exemple #24
0
	def editStudentDetails(self, university):
		print("\n \n \n")
		print("EDITING STUDENT DETAILS:")
		ID = input("Enter a Student ID: ")
		if university.studentExists(ID):
			student = university.students[ID]
			courseCode = student.course
			
			university.students.pop(ID,None)
			newStudent = Student()
			newStudent.setID(ID)
			newStudent.setCourse(courseCode)
			
			lName = input("Enter a Last name: ")
			newStudent.setLName(lName)
			fName = input("Enter a First name: ")
			newStudent.setFName(fName)
			degreeType = input("[U] Undergraduate / [P] Postgraduate: ")
			degreeType = validator.validateDegreeType(degreeType)
			newStudent.setDegreeType(degreeType)
			residencyType = input("[D] Domestic / [I] International: ")
			residencyType = validator.validateResidencyType(residencyType)
			newStudent.setResidencyType(residencyType)
			studyType = input("[F] Full-time / [P] Part-time: ")
			studyType = validator.validateStudyType(studyType)
			newStudent.setStudyType(studyType)

			university.addStudent(newStudent)
			
			print("\nSUCCESS: STUDENT RECORD EDITED\n")
			newStudent.displayDetails()
		else:
			print("ERROR: Student ID does not exist")
		print("\n \n \n")
Exemple #25
0
#!/usr/bin/env python
# people.py - Student, Person program
from Person import Person
from Student import Student

person1 = Person("Bob", 28)
person2 = Person("Jack", 42)
person3 = Student("Mary", 38, "English", 3.5)
person4 = Student("Joe", 31)
person4.setMajor("Math")
person4.setGPA(3.8)

print "There are %d people" %Person.numPersons()

for person in (person1, person2, person3, person4):
    print person

#################################################
#
#    $ people.py
#    There are 4 people
#    Name: Bob Age: 28
#    Name: Jack Age: 42
#    Name: Mary Age: 38 Major: English GPA: 3.5
#    Name: Joe Age: 31 Major: Math GPA: 3.8
#
Exemple #26
0
        "1.Create Stack\n2.Push object\n3.Pop object\n4.Peek\n5.total elements\n6.exit"
    )
    try:

        choice = int(input())
        while (choice not in range(1, 7)):
            choice = int(input("enter a valid choice: "))
    except:
        print("invalid choice try again \n")
        continue
    if (choice == 1):
        stack_size = int(input("enter stack size :"))
        stack_name = Stack(stack_size)
        print("Stack is create with size:", stack_size)
    elif (choice == 2):
        stack_name.push(
            Student(input("enter name :\n"), int(input("roll no:\n")),
                    int(input("age:\n"))))
    elif (choice == 3):
        print("\n\nelement:\n", stack_name.pop(), "\n")
    elif (choice == 4):
        print("\n\npeek element:\n", stack_name.peek(), "\n")
    elif (choice == 5):
        print("total elements:", stack_name.total_elements(), "\n")

# Student_record=Stack(30)
# obj=Student("Nitesh",21,21)
# Student_record.push(obj)
# print("peek\n",Student_record.peek(),"empty ",Student_record.isEmpty())
# print("\npopped element\n",Student_record.pop())
# Student_record.pop()
#Using the Student.py file to create a new class
# #eg honor roll student

from Student import Student

Student1 = Student("Sally", "Accounting", 3.7, False)
Student2 = Student("Mark", "Clown Studies", 3.9, False)

print(Student2.on_honour_roll())
Exemple #28
0
from functools import reduce
from Student import Student
# import Student

g_grades = ['A', 'B', 'C', 'D', 'F']
g_grades.reverse()

students = []
with open('students.csv', 'r', encoding='utf8') as file:
    for i, line in enumerate(file):
        if i == 0: continue
        students.append( Student(line) )

students.sort(key = lambda stu: stu.score, reverse = True)
m = map(lambda stu: stu.make_grade(), students)
list(m)

def sumfn(x, y):
    if type(x) == int:
        return x + y.score
    else:
        return x.score + y.score

# total = reduce(lambda x, y: (x if type(x) == int else x.score) + y.score, students)
total = reduce(sumfn, students)
avg = total / len(students)
print("총계, 평균>>>", total, avg)

print("이름\t성별\t나이\t학점")
print("----\t----\t----\t----")
for s in students:
#     4. If you have time, try creating a Roster class that allows you to 
#        store students. This allows us to have different Roster objects 
#        corresponding to, say, different classes or class years.
#
#     5. Make sure your Roster class has a print_all method that prints the 
#        details of every student it holds. Call it summarize, or something
#        similar.
#
###############################################################################

# Class Roster.
roster = Roster()

while True:

    # Get information and assign via unpacking, and then instantiate a new
    # Student. Order matters for unpacking.
    first, last, middle, address, email, phone = get_student_information()
    student = Student(first, last,middle, address, email,phone)

    student.print_info()
    # Prompt for confirmation.
    if confirm('Is this information correct? (Y/n) '):
        roster.add(student)
        
        if confirm('Would you like to add a student to the roster? (Y/n) '):
            continue
        else:
            roster.summarize()
            break
Exemple #30
0
	def createStudent(self,baseID,university):
		print("\n \n \n")
		print("ADDING A STUDENT TO UNIVERSITY:")
		courseCode = input("Enter a Course code: ")
		if university.courseExists(courseCode):
			
			newStudent = Student()
			newStudent.setID(str(baseID))
			newStudent.setCourse(courseCode)
			
			lName = input("Enter a Last name: ")
			newStudent.setLName(lName)
			fName = input("Enter a First name: ")
			newStudent.setFName(fName)

			validDegType = False
			while not validDegType:
				degreeType = input("[U] Undergraduate / [P] Postgraduate: ")
				validDegType, degreeType = validator.validateDegreeType(degreeType)
				if validDegType:
					newStudent.setDegreeType(degreeType)
				else:
					print("ERROR: please enter either U or P")

			validResType = False
			while not validResType:
				residencyType = input("[D] Domestic / [I] International: ")
				validResType, residencyType = validator.validateResidencyType(residencyType)
				if validResType:
					newStudent.setResidencyType(residencyType)
				else:
					print("ERROR: please enter either D or I")

			validStudType = False
			while not validStudType:
				studyType = input("[F] Full-time / [P] Part-time: ")
				validStudType, studyType = validator.validateStudyType(studyType)
				if validStudType:
					newStudent.setStudyType(studyType)
				else:
					print("ERROR: please enter either F or P")

			print("Please enter Campus")
			print("\n[1] - Clayton \n[2] - Caulfield \n[3] - Berwick \n[4] - Peninsula \n[5] - Parkville")
			command = promptCommand(1,5)
			command = int(command)
			if command == 1:
				newStudent.setCampus('Clayton')
			elif command == 2:
				newStudent.setCampus('Caulfield')
			elif command == 3:
				newStudent.setCampus('Berwick')
			elif command == 4:
				newStudent.setCampus('Peninsula')
			elif command == 5:
				newStudent.setCampus('Parkville')
			else:
				print("ERROR ASSIGNING CAMPUS ")

			course = university.courses[courseCode]
			course.addStudent(newStudent.ID)
			university.addStudent(newStudent)
			university.addCourse(course)
			
			print("\nSUCCESS: STUDENT RECORD CREATED")
			newStudent.displayDetails()
			return baseID + 1
		else:
			print("ERROR: Course code does not exist")
			return baseID
		print("\n \n \n")
Exemple #31
0
from Student import Student
from Animals import Cat, Dog, Runky
# create a student
#jesse = student('jesse', '100')

if __name__ == '__main__':
    #    jesse.grade()
    #    cat = Cat()
    #    cat.run()
    #    cat.eat()
    #    print()
    #    dog = Dog()
    #    dog.run()
    #    runky = Runky()
    #    runky.run()
    #   print(runky.get_name())
    me = Student()
Exemple #32
0
def barChart():
    studentList = []
    studentList.append(Student(50123456, 'lam tai man', 70.0, 60.0))
    studentList.append(Student(50223456, 'li tai man', 60.0, 90.5))
    studentList.append(Student(50323456, 'wong tai man', 34.5, 30.0))
    studentList.append(Student(50423456, 'ng tai man', 90.5, 70.0))
    studentList.append(Student(50523456, 'lau tai man', 86.0, 92.4))
    studentList.append(Student(50623456, 'chui tai man', 70.0, 64.5))
    studentList.append(Student(50723456, 'lim tai man', 64.5, 60.0))
    studentList.append(Student(50823456, 'pok tai man', 37.5, 35.50))
    studentList.append(Student(50923456, 'kim tai man', 92.4, 60.0))
    studentList.append(Student(50023456, 'tsang tai man', 15.0, 20.0))
    studentList.append(Student(50999999, 'chan peter', 100.00, 80.00))

    gradeFeq = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0}

    for e in studentList:
        mark = e.overall()
        if mark > 75:
            gradeFeq['A'] += 1
        elif mark > 65 and mark < 75:
            gradeFeq['B'] += 1
        elif mark > 50 and mark < 65:
            gradeFeq['C'] += 1
        elif mark > 40 and mark < 50:
            gradeFeq['D'] += 1
        else:
            gradeFeq['F'] += 1

    fig = plt.figure(figsize=(8, 6))  # width x height in inches
    ax1 = fig.add_subplot(111)  # 1 row 1 columns, column 1
    plt.title('Grade Distribution')  #set up the barchart title
    plt.ylabel('Student Number')  #set up the name of Y-axis
    plt.xlabel('Grade')  #set up the name of X-axis
    ax1.bar(['A', 'B', 'C', 'D', 'F'], [
        gradeFeq['A'], gradeFeq['B'], gradeFeq['C'], gradeFeq['D'],
        gradeFeq['F']
    ])  # vertical bar charts
    plt.show()
## Classes & Objects
# to create your own data types >> Student.py
# from file import class
from Student import Student
from Student2 import Student2

# create an actual student >> object
# name, major...
student1 = Student("Pista", "Business", 3.1, False)
student2 = Student("Joli", "Art", 3.5, True)

print(student1.name)
print(student2.is_on_probation)

# you can do objects and classes with anything...
# you can model real world objects
Exemple #34
0
    def createStudent(self, baseID, university):
        print("\n \n \n")
        print("ADDING A STUDENT TO UNIVERSITY:")
        courseCode = input("Enter a Course code: ")
        if university.courseExists(courseCode):

            newStudent = Student()
            newStudent.setID(str(baseID))
            newStudent.setCourse(courseCode)

            lName = input("Enter a Last name: ")
            newStudent.setLName(lName)
            fName = input("Enter a First name: ")
            newStudent.setFName(fName)

            validDegType = False
            while not validDegType:
                degreeType = input("[U] Undergraduate / [P] Postgraduate: ")
                validDegType, degreeType = validator.validateDegreeType(
                    degreeType)
                if validDegType:
                    newStudent.setDegreeType(degreeType)
                else:
                    print("ERROR: please enter either U or P")

            validResType = False
            while not validResType:
                residencyType = input("[D] Domestic / [I] International: ")
                validResType, residencyType = validator.validateResidencyType(
                    residencyType)
                if validResType:
                    newStudent.setResidencyType(residencyType)
                else:
                    print("ERROR: please enter either D or I")

            validStudType = False
            while not validStudType:
                studyType = input("[F] Full-time / [P] Part-time: ")
                validStudType, studyType = validator.validateStudyType(
                    studyType)
                if validStudType:
                    newStudent.setStudyType(studyType)
                else:
                    print("ERROR: please enter either F or P")

            print("Please enter Campus")
            print(
                "\n[1] - Clayton \n[2] - Caulfield \n[3] - Berwick \n[4] - Peninsula \n[5] - Parkville"
            )
            command = promptCommand(1, 5)
            command = int(command)
            if command == 1:
                newStudent.setCampus('Clayton')
            elif command == 2:
                newStudent.setCampus('Caulfield')
            elif command == 3:
                newStudent.setCampus('Berwick')
            elif command == 4:
                newStudent.setCampus('Peninsula')
            elif command == 5:
                newStudent.setCampus('Parkville')
            else:
                print("ERROR ASSIGNING CAMPUS ")

            course = university.courses[courseCode]
            course.addStudent(newStudent.ID)
            university.addStudent(newStudent)
            university.addCourse(course)

            print("\nSUCCESS: STUDENT RECORD CREATED")
            newStudent.displayDetails()
            return baseID + 1
        else:
            print("ERROR: Course code does not exist")
            return baseID
        print("\n \n \n")
Exemple #35
0
 def add(self, name, faculty, course):
     self.slist.append(Student(name, faculty, course))
     return True
#!/usr/bin/python

from Course import Course
from Student import Student
from CoreEngine import CoreEngine

m = CoreEngine()

m.set_class_size_constraint(3)
m.set_max_course_constraint(2)

for i in range(12):
    c = Course.from_db(i)
    m.add_course(c)

for i in range(5):
    s = Student()
    s.name("Student " + str(i))
    s.id(i)
    m.add_student(s)
    m.add_requested_course(s, Course.from_db(1))

m.generate_report()
Exemple #37
0
 def create_student(self, studentid, studentlastname, studentfirstname, teacherid, teacherlastname, teacherfirstname):
     student = Student(studentid, studentlastname, studentfirstname)
     teacher = Teacher(teacherid, teacherlastname, teacherfirstname)
     student.teacher = teacher
     return student
Exemple #38
0
        return f"{self.num}/{self.den}"                 # Curly brackets allow you to pull integers into the string

    def __add__(self, other):
        newNum = (self.num * other.den) + (other.num * self.den)
        newDen = self.den * other.den
        gcd = math.gcd(newNum, newDen)
        return Rational(newNum//gcd, newDen//gcd)       # // allows integer division. Otherwise you'd get decimals.

    def __eq__(self, other):
        if self is other:
            return True
        elif type(self) != type(other):
            return False
        else:
            return self.num == other.num and self.den == other.den

oneHalf = Rational(1, 2)
print(oneHalf)
oneSixth = Rational(1, 6)
print(oneSixth)
oneHalf + oneSixth
oneHalf.__add__(oneSixth)                                # Same as the line above. Line above is shorthand for this.

bob = Student(1, "Bob", 5)

print(oneHalf == oneHalf)
print(oneHalf == bob)
print (oneHalf == Rational(1, 2))

#print(Rational.den)                                     # Error. den is not a static varible
print(Rational.myConstVal)
Exemple #39
0
from Student import Student

#student1 = Student("Jim", "Business", 3.0, False)
#student2 = Student("Pam", "Comp Sci", 4.0, True)

students = [
    Student("Jim", "Business", 3.0, False),
    Student("Pam", "Comp Sci", 4.0, True)
]

#print(student1.name)

#print(student2.on_honor_roll())

for student in students:
    print("Name: " + student.name)
    print("Major: " + student.major)
    print("GPA: " + str(student.gpa))
    print("On probation: " + str(student.is_on_probation))
    print("On honor roll: " + str(student.on_honor_roll()))
from Student import Student  #first Student is the file then the second Student is the class, Student itself

student1 = Student("Mark", "Computer Science", 4.0, False)
student2 = Student("Pam", "Art", 2.5, True)
print(student1.major + " " + str(student1.gpa))
Exemple #41
0
    counts.append(output["model_counts"])

print("Accuracy: ", accuracy(torch.tensor(predict), teacher_targets))

print("\n")
print("\n")

print("Training Student")

print("\n")
print("\n")

# Split the test data further into training and validation data for student
train, val = split(test_loader, args.batchsize)

student = Student(args, Model())
N = NoisyDataset(train, teacher.predict)
student.train(N)

results = []
targets = []

total = 0.0
correct = 0.0

for data, target in val:

    predict_lol = student.predict(data)
    correct += float((predict_lol == (target)).sum().item())
    total += float(target.size(0))
Exemple #42
0
from Student import Student

bart = Student('Bart', 20, '21')
bart.print_score()
print(bart.get_grade())
from Student import Student
from types import MethodType

st = Student('dwj', 12)
print(st.name + ', ' + str(st.age))


def set_score(self, score):
    if not isinstance(score, int):
        raise ValueError('score must be an interge')
    if score < 0 or score > 100:
        raise ValueError('score must be in range')
    self.score = score


st.set_score = MethodType(set_score, st)
st.set_score(12)
print(str(st.score))

st.addr = "jiangsu"

print(st.addr)
Exemple #44
0
from Date import Date
from Student import Student

s1 = Student("John", Date(6, 1, 1999), 90)
s2 = Student("Marry", Date(10, 8, 1997), 80)

name = input()
month = int(input())
day = int(input())
year = int(input())

s1.setName(name)
s2.setDate(Date(month, day, year))

s1.toString()
s2.toString()
Exemple #45
0
def initStudents():
    weights1 = {
        'West': 6,
        'East': 10,
        'North': 4,
        'South': 8,
        'Case': 1,
        'Linde': 7
    }
    stud1 = Student(1, None, weights1, 'A')
    students.append(stud1)

    weights2 = {
        'West': 1,
        'East': 9,
        'North': 7,
        'South': 20,
        'Case': 1,
        'Linde': 17
    }
    stud2 = Student(1, None, weights2, 'B')
    students.append(stud2)

    weights3 = {
        'West': 13,
        'East': 5,
        'North': 20,
        'South': 15,
        'Case': 7,
        'Linde': 5
    }
    stud3 = Student(1, None, weights3, 'C')
    students.append(stud3)

    weights4 = {
        'West': 19,
        'East': 19,
        'North': 1,
        'South': 3,
        'Case': 14,
        'Linde': 20
    }
    stud4 = Student(1, None, weights4, 'D')
    students.append(stud4)

    weights5 = {
        'West': 13,
        'East': 7,
        'North': 2,
        'South': 20,
        'Case': 4,
        'Linde': 8
    }
    stud5 = Student(1, None, weights5, 'E')
    students.append(stud5)

    weights6 = {
        'West': 3,
        'East': 5,
        'North': 18,
        'South': 8,
        'Case': 12,
        'Linde': 13
    }
    stud6 = Student(1, None, weights6, 'F')
    students.append(stud6)
Exemple #46
0
except ValueError:
    print('invalid input')

fruits = open('fruits.txt', 'w')
fruits.write('\nwatermelon')
fruits.write('\napple')
fruits.write('\nplum')
fruits.close()

import info

print(info.feet_in_mile)

from Student import Student

jake = Student("Sahil", "Computer Science", 3.68, False)

print(jake.gpa)

from Question import Question

question_prompts = [
    "What color is the sky?\n(a) Blue\n(b) Red\n(c) Purple\n\n",
    "What color are apples?\n(a) Red\n(b) Blue\n(c) Green\n\n",
    "What color are bananas?\n(a) Teal\n(b) Yellow\n(c) Black\n\n",
]

questions = [
    Question(question_prompts[0], 'a'),
    Question(question_prompts[1], 'a'),
    Question(question_prompts[2], 'b'),
# Employees==================================================================================

employee1 = Employee(1000, 500, 'HR Consultant', [434, 200, 1020],
                     'Ahmad Yazan', 'Amman, jordan')
employee2 = Employee(2000, 750, 'Department Manager', [150, 3000, 250],
                     'Rana Hala', 'Aqaba, jordan')
employee3 = Employee(3000, 600, 'HR S Consultant',
                     [304, 1000, 250, 300, 500, 235], 'Mohammad Obeidat',
                     'Irbid, jordan')
employee4 = Employee(4000, 865, 'Director', [], 'Yasmeen Mohammad',
                     'Karak, jordan')

# Students ===================================================================================
student1 = Student(20191000, 'Java Programming Language', {
    'english': 80,
    'arabic': 90,
    'art': 95,
    'management': 75
}, 'Mohammad Obeidat', 'Irbid, Jordan')

student2 = Student(
    20182000, 'Software Eng.', {
        'english': 80,
        'arabic': 90,
        'calculus': 85,
        'management': 75,
        'OS': 73,
        'Programming': 90
    }, 'Reem Hani', 'Zarqa, Jordan')

student3 = Student(20161001, 'Arts', {
    'english': 83,
Exemple #48
0
from Student import Student
from Magistrant import Magistrant

student = Student()
magistrant = Magistrant()

print(student.read_a_book())
print(student.get_credit())
print(magistrant.get_credit())
Exemple #49
0
				totals[ourKey] = totals[ourKey] + ourTotal
			else:
				totals[ourKey] = ourTotal

			if re.match( "[Hh]omework", ourKey ):
				numHomeworks = numHomeworks + 1
			elif re.match( "[Qq]uiz", ourKey ):
				numQuizzes = numQuizzes + 1
			elif re.match( "[Ee]xam", ourKey ):
				numExams = numExams + 1

		firstAdded = 1
	
	elif len( splits ) == numArgs:			# gather information only if the line contains correct number of fields
	
		currentStudent = Student( splits[0] )
		splits.pop( 0 )
		fieldNumber = 1
		
		for score in splits:
			
			score = score.strip()

			if fieldNumber <= numHomeworks:
				currentStudent.addHomework( int(score) )
			elif fieldNumber <= ( numHomeworks + numQuizzes ):
				currentStudent.addQuiz( int(score) )
			elif fieldNumber <= ( numHomeworks + numQuizzes + numExams ):
				currentStudent.addExam( int(score) )

			fieldNumber = fieldNumber + 1
Exemple #50
0
from Student import Student

student1 = Student("Oscar", "Accounting", 3.1)
student2 = Student("Phyllis", "Business", 3, 8)
Exemple #51
0
import sys
sys.path.append('modules')

import datetime
from pprint import pprint
from Student import Student

s = Student()
s.name = "Neil"

print(s.name)
s.showName()

Student.MyMethod()

print(Student.Query.test())

print(s.Query.test())
Exemple #52
0
from Student import Student

student1 = Student("Jim", "Business", 3.1, False)

print(student1.name)
 def get_students(self, group_name):
     students = Student.get_by_group(group_name)
     if students is None:
         self.render('form_groupes.html', error=u"Nous n'avons pas réussi à récupérer la liste des élèves de ce groupe.")
         return
     self.render('groupes.html', students=students, group_name=group_name)
from Student import Student

student1 = Student("Oscar", "Accounting", 2.1)
student2 = Student("Amy", "Comp Science", 4.0)

print(student2.on_honour_roll())
Exemple #55
0
from Date import Date
from Student import Student

name = str(input())
mon = int(input())
day = int(input())
year = int(input())

student1 = Student("John", Date(6, 1, 1999), 90)
student2 = Student("Marry", Date(10, 8, 1997), 80)

student1.setName(name)
student2.setBirthDay(Date(mon, day, year))

print(student1)
print(student2)
Exemple #56
0
from Student import Student
from Bank import BankAccount

# alice = Person("Alice","Alicson",28)
alice = Student("Alice", "Alicson", 28, "1234", 3.9)
alice_account = BankAccount(alice)
alice_account.credit(1000)
print(alice_account)

print(alice_account.debit(500))
print(alice_account)

print(alice_account.debit(600))
print(alice_account)
from Student import Student

student1 = Student('Mike', 'OS', 2.9, True)
student2 = Student('John', 'OS', 3.9, True)

# print(student1.name + '\n', student1.major)

print(student1.on_honour_roll())
print(student2.on_honour_roll())
def main():

    debug = False
    root = Tk()
    root.withdraw()
    run_time = datetime.now().strftime('%Y%m%d%H%M') # used for file extensions, makes sorting easy
    print("\nMathnasium Scheduler Launched")
    default_directory = "C:\\ProgramData\\MathnasiumScheduler"
    FILEOPENOPTIONS = dict(defaultextension='.csv', filetypes=[('XLSX', '*.xlsx'), ('CSV file', '*.csv')])
    # Todo-jerry add center name picklist, get center names from configuraton file
    center_name = simpledialog.askstring("Name prompt", "Enter Center Name")
    schedule_start_date = simpledialog.askstring("Schedule Start Prompt", "Enter Schedule Start Date (MM/DD/YY)")
    # center_name = "aaaa.TestRun" #Eliminates need to select files for successive test runs
    importer = Importer().import_all(run_time, default_directory, center_name, FILEOPENOPTIONS)

    #Create Schedule Workbook
    # Create Run Workbook
    run_wb_path = default_directory + "\\" + center_name + "." + run_time + ".xlsx"
    run_wb = Workbook()
    run_wb.save(run_wb_path)
    schedule_by_name_ws = run_wb.create_sheet("Schedule By Name", index=0)
    schedule_by_day_ws = run_wb.create_sheet("Schedule By Day", index=1)
    forecast_summary_ws = run_wb.create_sheet("Summary Forecast", index=2)
    forecast_detailed_ws = run_wb.create_sheet("Detailed Forecast", index=3)
    run_log_ws = run_wb.create_sheet("Runlog", index=4)
    #ToDo Write run_log to run_log_ws
    run_log = []
    instructors = Instructor.create_instructors(run_log)
    students = Student.initialize_students(importer.attendance_ws, importer.student_data_ws, run_log)

    #Create Events
    print("\nCreating events from student arrivals and departures\n")
    events = []
    for each_student in Student.students:
        events.append(Event('Arrival', each_student.arrival_time, each_student))
        events.append(Event('Departure', each_student.departure_time, each_student))
    events.sort()

    #Executing Events
    print("Executing events and collecting information")
    # Gather events by week day
    #ToDo refactor this into Common and use common
    # define days consistent with datetime.weekday()
    mon = 0
    tue = 1
    wed = 2
    thu = 3
    fri = 4
    sat = 5
    sun = 6

    # Group events by day
    event_groups = {sun: [], mon: [], tue: [], wed: [], thu: [], fri: [], sat: []}
    for each_event in events:
        event_groups[each_event.event_time.weekday()].append(each_event)

    print("\tDetermining cost of each day")
    costsOfEventGroups = {}
    for each_day in event_groups.keys():
        cost = 0.0
        for each_event in event_groups[each_day]:
            if each_event.is_arrival_event: cost = cost + each_event.cost()
        costsOfEventGroups[each_day] = round(cost, 1)
        print("\t\tDay: ", each_day, "Cost: ", costsOfEventGroups[each_day])

    # Sort and process each group of events
    for each_day in event_groups.keys():
        print("\n\tProcessing Day: ", str(each_day))
        event_groups[each_day].sort()
        instructorsMinimum = 2.0  # ToDo remove hard coded variable the minimum staffing level
        instructorsRequired = 0.0  # actual number of instructors required to meet student demand
        event_number = 1  # first event number
        student_count = 0  # start with zero students
        for each_event in event_groups[each_day]:
            # Set event number
            each_event.event_number = event_number
            # Set event's previous and next events
            if event_number != 1: each_event.prev = events[events.index(each_event) - 1]
            if event_number != len(event_groups[each_day]): each_event.next = event_groups[each_day][
                event_groups[each_day].index(each_event) + 1]
            event_number = event_number + 1  # next event number
            # Maintain student count
            if (each_event.is_arrival_event):
                student_count = student_count + 1
            elif (each_event.is_departure_event):
                student_count = student_count - 1
            each_event.student_count = student_count
            # Compute/maintain the actual number of instructors required
            instructorsRequired = instructorsRequired + each_event.cost()
            # Compute/maintain the number of instructors to staff (minimum is instructorsMinimum)
            each_event.instructor_count = max(instructorsMinimum, math.ceil(instructorsRequired))

        print("\t\tCollecting Instructor Change Events")
        instructor_change_events = []
        for each_event in event_groups[each_day]:
            if each_event.is_instructor_change_event():
                instructor_change_events.append(each_event)

        print("\t\tMarking Churn Events")
        tolerance = 360  # seconds (6 minutes)
        for i in range(len(instructor_change_events) - 1):
            event = instructor_change_events[i]
            next_event = instructor_change_events[i + 1]
            event.isChurnEvent = event.is_peak_event() and next_event.is_valley_event() \
                                 and (next_event.event_time - event.event_time).seconds < tolerance

        print("\t\tScheduling Instructors")
#        instructors = Instructor.instructors
        instructors.sort()
        if debug:
            for eachInstructor in instructors: print(eachInstructor)
        inactive_instructors = instructors
        active_instructors = []
        dateChangeEvents = 0

        for each_event in event_groups[each_day]:
            if each_event.is_date_change_event():
                dateChangeEvents = dateChangeEvents + 1
                # Activate minimum number of instructors needed to open if necessary
                active_instructor_count = 0
                inactive_instructors.sort()
                instructors_changed = []
                for this_instructor in inactive_instructors:
                    if this_instructor.isAvailableToOpen(each_event) and (active_instructor_count < instructorsMinimum):
                        active_instructor_count = active_instructor_count + 1
                        this_instructor.startWorkWhenOpen(each_event)
                        active_instructors.append(this_instructor)
                        # save pointers to instructors for removal from unscheduled list
                        instructors_changed.append(this_instructor)
                for i in instructors_changed: inactive_instructors.remove(i)

            # Check for and remove departing Instructors
            departed_instructors = []
            for this_instructor in active_instructors:
                departed = False
                if this_instructor.mustDepart(each_event):
                    this_instructor.departWork(each_event)
                    departed_instructors.append(this_instructor)

            instructor_change_needed = each_event.instructor_count - len(active_instructors)
            if not each_event.is_churn_event and instructor_change_needed > 0:
                # Schedule available instructors
                # print("\t\t\tActivate Instructor")
                active_instructor_count = 0
                inactive_instructors.sort()
                # print("Inactive Instructors: " + str(len(inactive_instructors)))
                while (active_instructor_count < instructor_change_needed):
                    # print('while')
                    # Find instructor and schedule instructor
                    instructors_changed = [] #ToDo inside the while loop (inconsistent see line 215)
                    for this_instructor in inactive_instructors:
                        if this_instructor.isAvailable(each_event) and (active_instructor_count < instructor_change_needed):
                            active_instructor_count = active_instructor_count + 1
                            this_instructor.startWork(each_event)
                            active_instructors.append(this_instructor)
                            # Save pointers to newly scheduled instructors for removal from unscheduled list
                            instructors_changed.append(this_instructor)
                # Remove newly activated (scheduled) instructors from inactive list
                for i in instructors_changed: inactive_instructors.remove(i)

            if not each_event.is_churn_event and instructor_change_needed < 0:
                # Deactivate instructors
                # print("\t\t\tDeactivate Instructor")
                deactivated_instructor_count = 0
                instructors_deactivated = [] #ToDo outside the while loop (inconsistent see line 200)
                active_instructors.sort()
                # print("Printing Reversed Rank List")
                # for this in reversed(active_instructors):
                #     print(this.name, this.rank)
                while deactivated_instructor_count < abs(instructor_change_needed):
                    for this_instructor in reversed(active_instructors):
                          if deactivated_instructor_count < abs(instructor_change_needed):
                            deactivated_instructor_count = deactivated_instructor_count + 1
                            this_instructor.stopWork(each_event)
                            inactive_instructors.append(this_instructor)
                            instructors_deactivated.append(this_instructor)
                for i in instructors_deactivated: active_instructors.remove(i)

            # Finalize schedules after last departure or final event of the day
            if (each_event == event_groups[each_day][len(event_groups[each_day]) - 1]) or each_event.next.is_date_change_event():
                instructors_changed = []
                for this_instructor in active_instructors:
                    this_instructor.isScheduled = False
                    inactive_instructors.append(this_instructor)
                    instructors_changed.append(this_instructor)
                for i in instructors_changed: active_instructors.remove(i)
                for i in inactive_instructors: i.finalizeSchedule()

    Reporter().write_all(events, instructors, forecast_detailed_ws, forecast_summary_ws, schedule_by_name_ws)

    print("\nReview, edit, and approve schedules")
    # Todo code to review, edit, and approve schedules

    print("\nFormating and Closing Workbooks")
    Importer().close_workbooks()
    Reporter().format_sheets(run_wb)
    run_wb.save(run_wb_path)
    run_wb.close()

    print("\nLaunching Excel")
    os.system("start excel " + run_wb_path )

    # Todo code up individual schedule emails including mapping to email addresses and instructor first names.
    print("\nEmailing Schedules to Instructors")
#    Gmailer().send_instructor_schedules(instructors)

    # Todo code up scheduling individual work events on master schedule calendar and instructor calendars.
    print("\nAdding Work Events to Instructor Google Calendars")
#    GoogleEventScheduler().insert_events(instructors)

    print("\nScheduler Run Completed")
    def test_Student(self):
        cen = Subject('English')
        cma = Subject('Math')
        cph = Subject('Physics')
        chi = Subject('History')
        cmu = Subject('Music')
        cpe = Subject('P.E.')
        j = Student('John')
        m = Student('Mary')
        b  = Student('Bob')
        c  = Student('Chris')
        
        j.setGrade(cen, 'A')
        j.setGrade(cma, 'B')
        j.setGrade(cph, 'A')
        j.setGrade(chi, 'B')
        j.setGrade(cmu, 'A')
        j.setGrade(cpe, 'A')
        
        m.setGrade(cen, 'A')
        m.setGrade(cma, 'C')
        m.setGrade(cph, 'A')
        m.setGrade(chi, 'B')
        m.setGrade(cmu, 'C')
        m.setGrade(cpe, 'A')

        b.setGrade(cen, 'C')
        b.setGrade(cma, 'F')
        b.setGrade(cph, 'D')
        b.setGrade(chi, 'B')
        b.setGrade(cmu, 'C')
        b.setGrade(cpe, 'A')

        j_gpa = Decimal(j.getGPA())
        m_gpa = Decimal(m.getGPA())
        b_gpa = Decimal(b.getGPA())

        print "j=" + str(j_gpa)
        print "m=" + str(m_gpa)
        print "b=" + str(b_gpa)

        assert((j_gpa > 3.66) and (j_gpa < 3.67))
        assert(m_gpa > 3.16 and m_gpa < 3.17) # fails
        assert(b_gpa < 2.01 and b_gpa > 1.99)