Advertisement
Guest User

Untitled

a guest
May 12th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.52 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Fri May 12 14:36:10 2017
  5.  
  6. @author: griffinhigley
  7. """
  8.  
  9. # instances stored in courses dict user srt ID to query
  10. class course():
  11. # dict that stores all of the courses key is srt ID
  12. courses = {}
  13.  
  14. def __init__(self,ID , name = 'NONE', year = '0000' ,semester = 'NA' ,gradeScale = 'Normal', instr = 00, roster = dict()):
  15. self.ID = ID
  16. self.name = name
  17. self.year = year
  18. self.semester = semester
  19. self.gradeScale = gradeScale
  20. self.instructor = instr
  21. self.roster = dict()
  22. # function that stores all of the course instances into the courses dict key is srt ID
  23.  
  24. course.courses[self.ID] = [self.name,self.year,self.semester, self.gradeScale, self.instructor, self.roster]
  25. if self.ID in course.courses:
  26. course1 = course.courses[self.ID]
  27. course.courses[self.ID] = course1
  28.  
  29.  
  30. # user has a dictionary that keeps track of all the instances of the class
  31. # student, instructor, and administrator all take inheritence from user
  32. class user():
  33. # this stores all the instances of the user class
  34. users = {}
  35.  
  36. def __init__(self, ID, firstName, lastName, userType, password, ):
  37. # user the id to search for user instances in the user dictionary
  38. self.ID = ID
  39. self.fisrtName = firstName
  40. self.lastName = lastName
  41. self.userType= userType
  42. self.password = password
  43.  
  44. # this puts the instances of the user class into the users dict.
  45. user.users[self.ID]=[self.fisrtName,self.lastName,self.userType,self.password]
  46.  
  47. # this searches a year and semester and lets you know what courses are offered then
  48. def search_course(self):
  49. count = 0
  50. #courseID = str(input('Please enter the course ID followed by the return key.\n'))
  51. course_year = str(input('Please enter the year you want to seach followed by the return key.\n'))
  52. course_semester = str(input('Please enter the semester you would like to search in followed by the return key.\n'))
  53. course_found = False
  54. # searches all of the courses
  55. for k in course.courses:
  56. cours = course.courses[k]
  57. #cours[1] is the year of the course
  58. if cours[1] == course_year:
  59. if cours[2] == course_semester:
  60. count = count + 1
  61. print('There is an offering of ', k, course.courses[k])
  62. course_found = True
  63.  
  64. print('we found ', count, 'courses')
  65.  
  66. if course_found == False:
  67. print('No offering found')
  68. #prints a list of all the course
  69. def print_courses(self):
  70. print(course.courses)
  71.  
  72.  
  73.  
  74. #has a dictionary for all student instances also is put in to the user dict
  75. class student(user):
  76. # stores all the student instances use the ID to query
  77. students = {}
  78.  
  79.  
  80. def __init__(self, ID, firstName, lastName, userType, password, schedual= dict(), grades = dict() ):
  81. self.ID = ID
  82. self.fisrtName = firstName
  83. self.lastName = lastName
  84. self.userType= userType
  85. self.password = password
  86. self.schedual = schedual
  87. self.grades = dict()
  88.  
  89. #puts the students information into the student directory
  90. student.students[self.ID]=[self.fisrtName,self.lastName,self.userType,self.password, self.schedual]
  91.  
  92. user.__init__(self, ID, firstName, lastName, userType, password)
  93. self.ID = ID
  94. self.fisrtName = firstName
  95. self.lastName = lastName
  96. self.userType= userType
  97. self.password = password
  98.  
  99. # Student course registration function
  100. def add_class(self):
  101. courseID = str(input('Please enter the course ID followed by the return key.\n'))
  102. courseYear = str(input('Enter the year that you would like to take this course\n'))
  103. courseSemester = str(input('Enter the semester you would like to take this course\n'))
  104. grade = 'NA'
  105. if courseID in course.courses:
  106. courseData = course.courses[courseID]
  107. if courseData[1] == courseYear and courseData[2] == courseSemester:
  108. self.schedual[courseID] = [course.courses[courseID], [courseID,grade]]
  109. print('Course',courseID,'was added to your schedual for that year and semester')
  110.  
  111. else:
  112. print('Sorry',courseID,'is not being offerend for that year and semester\n')
  113. else:
  114. print('Sorry',courseID,'was not found in the courses that we offer. Make sure that you typed the ID in correct\n')
  115.  
  116. def print_grades(self):
  117. ID = self.ID
  118. #this is used to grab the grade data from the student class
  119. stud = student.students[ID]
  120. classGrades = stud[4]
  121. print(classGrades)
  122.  
  123. def print_class_grade(self):
  124. Cl = str(input('Please enter the course ID that you would like to see your grade for.\n'))
  125. clyear = str(input('enter the year you took this course.\n'))
  126. clsemester = str(input('enter the semester you took this course.\n'))
  127. studSchedual = self.schedual
  128. if Cl in studSchedual:
  129. cour = self.schedual[Cl]
  130. Cldata = cour[0]
  131. Clyear = Cldata[1]
  132. Clsemester = Cldata[2]
  133. if Clyear == str(clyear) and Clsemester == str(clsemester):
  134. print(cour)
  135.  
  136. else:
  137. print('looks like you have taken that course just not in the year and semester you entered.\n')
  138.  
  139. else:
  140. print('Looks like you have not taken that course.\n')
  141.  
  142. def print_schedual(self):
  143. courseYear = str(input('Enter the year that you would like to take this course\n'))
  144. courseSemester = str(input('Enter the semester you would like to take this course\n'))
  145. courseFound = False
  146. for Cl in self.schedual:
  147. if str(self.schedual[Cl][1]) == courseYear and str(self.schedual[Cl][1]) == courseSemester:
  148. courseFound = True
  149. print('You have course',Cl,courseYear,'and',courseSemester)
  150. if courseFound == False:
  151. print('You do not seem to have any courses for that year and semester')
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158. # all of the students
  159. Connie = student('10001','Connie','Willis','student','Cw1001' )
  160. Kristine = student('10002','Kristine','Rusch','student','Kr1002')
  161. Gregory = student('10003','Gregory','Benford','student','Gb1003')
  162. Carlos = student('10004','Carlos','Hernadez','student','Ch1004')
  163. Nnedi = student('10005','Nnedi','Okarafor','student','No1005')
  164. Cartherynne = student('10006','Cartherynne','Valente','student','Cv1006')
  165.  
  166.  
  167. # has a dictionary that stores all the instances also instances are but in the user dict
  168. class instructor(user):
  169. # stores all of the instances of the instructors user ID to query
  170. instructors = {}
  171.  
  172. def __init__(self, ID, firstName, lastName, userType, password, schedual = dict()):
  173.  
  174. self.ID = ID
  175. self.fisrtName = firstName
  176. self.lastName = lastName
  177. self.userType= userType
  178. self.password = password
  179. self.schedual = schedual
  180.  
  181. # funtion stores all of the instances in the instructors dict
  182. instructor.instructors[self.ID]=[self.fisrtName,self.lastName,self.userType,self.password, self.schedual]
  183.  
  184. user.__init__(self, ID, firstName, lastName, userType, password)
  185. self.ID = ID
  186. self.fisrtName = firstName
  187. self.lastName = lastName
  188. self.userType= userType
  189. self.password = password
  190.  
  191. #course.courses[self.ID] = [self.name,self.year,self.semester, self.gradeScale, self.instructor, self.roster]
  192.  
  193. def printCourseLoad(self):
  194. clyear = str(input('Please enter the year you want to get you schedule for.\n'))
  195. clsemester = str(input('Enter the semester you want to chech your schedule for\n'))
  196. for cl in self.schedual:
  197. print('1213123')
  198.  
  199. if str(self.schedual[cl][2]) == clyear and str(self.schedual[cl][3]) == clsemester:
  200. print(self.schedual[cl])
  201. print('ssdfsdfsdf')
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211. def print_all_course_grades(self):
  212. courseFound = False
  213. gradeFound = False
  214. for cours in course.courses:
  215. cour = course.courses[cours]
  216. #print(cour[4])
  217. #print(self.ID)'
  218. if str(cour[4]) == self.ID:
  219. courseFound = True
  220. for stud in student.students:
  221. stu = student.students[stud]
  222.  
  223. if cours in stu[4]:
  224. gradeFound = True
  225. #print('1124124')
  226. print('------------')
  227. grad = stu[4]
  228. print(cours,':',cour[0],':',stu[0],':',grad[cours])
  229. if courseFound == False:
  230. print('Looks like you do not have any courses assigned to you\n')
  231. if gradeFound ==False:
  232. print('Looks like there are no students in any of your courses\n')
  233.  
  234.  
  235. def print_course_grades(self):
  236. studentFound = False
  237. ClID = str(input('Enter the Course ID that you want to print.\n' ))
  238. ClYear = str(input('Enter the year you want to print.\n'))
  239. ClSemeter = str(input('Enter the semester you want to print.\n'))
  240. if ClID in self.schedual:
  241. cour = self.schedual[ClID]
  242. print(cour[1])
  243. print(cour[2])
  244. Cldata = cour
  245. Clyear = Cldata[1]
  246. Clsemester = Cldata[2]
  247. if ClYear == Clyear and ClSemeter == Clsemester:
  248. for stud in student.students:
  249. stu = student.students[stud]
  250. if ClID in stu[4]:
  251. studentFound = True
  252. print('------------')
  253. grad = stu[4]
  254. print(ClID,':',Clyear,':',Clsemester,':',Cldata[0],':',stu[0],':',grad[ClID])
  255. else:
  256. print('Looks like you infact do teach this class just not for this semester.\n')
  257. else:
  258. print('Sory you can only print the grades of courses that you are the assigned intructor of.\n')
  259.  
  260. if studentFound == False:
  261. print('Looks like there are no students taking this course.\n')
  262.  
  263. def class_grade_assign(self):
  264. studFound = False
  265. print('This will change the grade of every student in the course.\n')
  266. option = str(input('Are you sure that you want to do this. please enter yes or no.\n'))
  267. if option.upper() == 'YES':
  268. Cl = str(input('Please enter the ID of the course that you would like to do a batch assign of grades to.\n'))
  269. if Cl in self.schedual:
  270. for ID in student.students:
  271. stud = student.students[ID]
  272. classGrades = stud[4]
  273. if Cl in classGrades:
  274. studFound = True
  275. print('student and course found.\n',ID)
  276. grade = str(input('Please enter the grade you would like this course to have.\n'))
  277. classGrades[Cl] = grade
  278. print('Grade change was successful')
  279.  
  280.  
  281. else:
  282. print('sory but you can only assign grades to students in classes that you teach\n')
  283. else:
  284. pass
  285. if studFound == False:
  286. print('We did not find any students in that course\n')
  287.  
  288. def student_assign_grade(self):
  289. Cl = str(input('Please enter the ID of the course that you would like to do a batch assign of grades to.\n'))
  290. ID = str(input('Please enter the ID of the student you wish to assign or change the grade of.\n'))
  291. if Cl in self.schedual:
  292. if ID in student.students:
  293. stud = student.students[ID]
  294. classGrades = stud[4]
  295.  
  296. if Cl in classGrades:
  297. print('student and course found.\n')
  298. grade = str(input('Please enter the grade you would like this course to have.\n'))
  299. classGrades[Cl] = grade
  300. print('Grade change was successful')
  301. print(classGrades)
  302. else:
  303. print('We found a student with that ID but they do not seem to have that course in their schedule\n')
  304. else:
  305. print('There does not seem to be any student with that ID\n')
  306. else:
  307. print('Sorry but you can only assign/change the grade of students grades in courses that you are the teacher of.\n')
  308.  
  309.  
  310.  
  311.  
  312. #This is for testing
  313. """def print_schedual(self):
  314. ClYear = str(input('Enter the year you want to print.\n'))
  315. ClSemeter = str(input('Enter the semester you want to print.\n'))
  316. for ClID in self.schedual:
  317. cour = self.schedual[ClID]
  318. Cldata = cour
  319. Clyear = Cldata[1]
  320. Clsemester = Cldata[2]
  321. if ClYear == Clyear and ClSemeter == Clsemester:
  322. print(ClID,':',self.schedual[ClID],':',ClYear,':',Clsemester)
  323.  
  324. else:
  325. print('Looks like you do not have any classes for that year and semester')"""
  326.  
  327. def see_if_student_in(self):
  328. ClID = str(input('Enter the Course ID that you want to print (capitalize and integer).\n' ))
  329.  
  330. ClYear = str(input('Enter the year you want to print(enter as integer).\n'))
  331. # do not capitalize
  332. ClSemeter = str(input('Enter the semester you want to print (Do not capitalize).\n'))
  333. studentID = str(input('Enter the ID of the student you wish to see if they are in your class(Enter as )'))
  334. studentFound = False
  335. if ClID in self.schedual:
  336. if studentID in student.students:
  337. if ClID in student.students[studentID][4]:
  338. sched = student.students[studentID][4]
  339. for Cl in sched:
  340. Clyear = sched[Cl][1]
  341. Clsemester = sched[Cl][2]
  342. if ClYear == str(Clyear) and ClSemeter == str(Clsemester):
  343. print(studentID,':',student.students[studentID][0],':',student.students[studentID][1],':','Is in your class',ClID,':','for the year',':',ClYear,':','and semester',':',ClSemeter)
  344. studentFound = True
  345. else:
  346. print('Looks like that student does not have that class for that year and semester\n')
  347. else:
  348. print('No student was found with that ID make sure you typed it in correctly\n')
  349. else:
  350. print('Sorry but you can only search courses that you are the instructor for\n')
  351. if studentFound == False:
  352. print('Student is not in that perticular course offering')
  353.  
  354. # print out the students in a course offering
  355. def print_roster(self):
  356. studentFound = False
  357. ClID = str(input('Enter the Course ID that you want to print (capitalize and integer).\n' ))
  358. ClYear = str(input('Enter the year you want to print(enter as integer).\n'))
  359. # do not capitalize
  360. ClSemeter = str(input('Enter the semester you want to print (Do not capitalize).\n'))
  361. if ClID in self.schedual:
  362. for studentID in student.students:
  363. if ClID in student.students[studentID][4]:
  364. sched = student.students[studentID][4]
  365. Clyear = sched[ClID][1]
  366. Clsemester = sched[ClID][2]
  367. if ClYear == str(Clyear) and ClSemeter == str(Clsemester):
  368. print(studentID,':',student.students[studentID][0],':',student.students[studentID][1],':','Is in your class',ClID,':','for the year',':',ClYear,':','and semester',':',ClSemeter)
  369. studentFound = True
  370. else:
  371. print('Sorry you can only print our a roster for classes you are teaching. If you are supost to be teaching this course please contact your admin\n')
  372. if studentFound == False:
  373. print('Looks like there are not student taking that course\n')
  374.  
  375.  
  376. def print_schedule(self):
  377. courseYear = str(input('Enter the year that you would like to take this course\n'))
  378. courseSemester = str(input('Enter the semester you would like to take this course\n'))
  379. courseFound = False
  380. for Cl in self.schedual:
  381. Clyear = self.schedual[Cl][1]
  382. Clsemester = self.schedual[Cl][2]
  383. if courseYear == str(Clyear) and courseSemester == str(Clsemester):
  384. courseFound = True
  385. print('You have course',Cl,courseYear,'for',courseSemester)
  386. if courseFound == False:
  387. print('You do not seem to have any courses for that year and semester')
  388.  
  389. # all of the instrucotrs
  390. Nancy = instructor('1003','Nancy','Kress','instructor','Nk1003')
  391. Vandana = instructor('1004','Vandana','Simgh','instructor','Vs1004')
  392. Usman = instructor('1005','Usman','Malik','instructor','Um1005')
  393.  
  394.  
  395. # instances are stored in administrators dict as well as user dict use str ID to query
  396. class administrator(user):
  397. # stores all the instances of administrators
  398. administrators = {}
  399.  
  400. def __init__(self, ID, firstName, lastName, userType, password):
  401. self.ID = ID
  402. self.fisrtName = firstName
  403. self.lastName = lastName
  404. self.userType= userType
  405. self.password = password
  406. # function that puts instances of administrator in administrators ditc user str ID to queryS
  407. administrator.administrators[self.ID]=[self.fisrtName,self.lastName,self.userType,self.password]
  408.  
  409. user.__init__(self, ID, firstName, lastName, userType, password)
  410. self.ID = ID
  411. self.fisrtName = firstName
  412. self.lastName = lastName
  413. self.userType= userType
  414. self.password = password
  415.  
  416. def creat_course (self):
  417. ID = str(input('Please enter the course ID followed by the return key.\n'))
  418. name = str(input('Please enter the course name followed by the return key.\n'))
  419. year = str(input('Please enter the course year followed by the return key.\n'))
  420. semester = str(input('Please enter the course semester followed by the return key.\n'))
  421. gradeScale = str(input('Please enter the course gradeScale followed by the return key.\n'))
  422. instructor = str(input('Please enter the course instructor followed by the return key.\n'))
  423. course.courses[ID] = [name, year, semester, gradeScale, instructor]
  424. print(course.courses[ID])
  425. def mod_course(self):
  426. ID = str(input('Please enter the course ID followed by the return key.\n'))
  427. name = str(input('Please enter the course name followed by the return key.\n'))
  428. year = str(input('Please enter the course year followed by the return key.\n'))
  429. semester = str(input('Please enter the course semester followed by the return key.\n'))
  430. gradeScale = str(input('Please enter the course gradeScale followed by the return key.\n'))
  431. instructor = str(input('Please enter the course instructor followed by the return key.\n'))
  432. if ID in course.courses:
  433. modCourse = course.courses[ID]
  434. print('Course Found!!!!\n')
  435. if len(name) != 0:
  436. modCourse[0] = name
  437. print('Course name change was successful.\n')
  438. if len(year) != 0:
  439. modCourse[1] = year
  440. print('Course Year change was successful.\n')
  441. if len(semester) != 0:
  442. modCourse[2] = semester
  443. print('Course semester change was successful.\n')
  444. if len(gradeScale) != 0:
  445. modCourse[3] = gradeScale
  446. print('Course gradeScale change was successful.\n')
  447. if len(instructor) != 0:
  448. modCourse[4] = instructor
  449. print('Course instructor change was successful.\n')
  450.  
  451. print('Course Mods where successful.\n')
  452. print(ID,course.courses[ID])
  453.  
  454. else:
  455. print('looks like that course in not in the catalog yet\n if you would like to add it please call the add course function')
  456.  
  457.  
  458. def change_grade(self):
  459. ID = str(input('Please enter the ID of the student you wish to change the grade of.\n'))
  460. Cl = str(input('Please enter the course ID for the course you wish to change the grade.\n'))
  461.  
  462. if ID in student.students:
  463. stud = student.students[ID]
  464. classGrades = stud[4]
  465.  
  466. if Cl in classGrades:
  467. print('student and course found.\n')
  468. grade = str(input('Please enter the grade you would like this course to have.\n'))
  469. classGrades[Cl] = grade
  470. print('Grade change was successful')
  471. print(classGrades)
  472.  
  473. def print_cl_grades(self):
  474. print('Some students may not have grades yet if that is the case then you will get back all the information about that student and course\n')
  475. courseID = str(input('Enter the ID of the course you would like to print all the grades of.\n'))
  476. ClYear = str(input('Enter the year you want to print(enter as integer).\n'))
  477. # do not capitalize
  478. ClSemester = str(input('Enter the semester you want to print (Do not capitalize).\n'))
  479. for ID in student.students:
  480. stud = student.students[ID]
  481. schedual = stud[4]
  482. if courseID in schedual:
  483. Cldata = schedual[courseID]
  484. Clyear = Cldata[1]
  485. Clsemester = Cldata[2]
  486. if ClYear == str(Clyear) and ClSemester == str(Clsemester):
  487. grade = schedual[courseID]
  488. name = stud[0:3]
  489. print(ID,name, grade)
  490. #self.schedual[courseID] = [course.courses[courseID], [courseID,grade]]
  491.  
  492.  
  493. def print_stud_grades(self):
  494. stuID = str(input('Enter the Id of the student you want to print the grades of.\n'))
  495. if stuID in student.students:
  496. stu = student.students[stuID]
  497. print(stuID,':',stu[0],':',stu[1],':',stu[4])
  498.  
  499.  
  500.  
  501. def print_inst_grades(self):
  502. instID = str(input('Enter the ID of the instructor you to print class grades of.\n'))
  503. if instID in instructor.instructors:
  504. inst = instructor.instructors[instID]
  505. instSched = inst[4]
  506. print(instSched)
  507.  
  508. def assign_inst_course(self):
  509. instID = str(input('Enter the ID the instructor you would like to assign a course to.\n'))
  510.  
  511. if instID in instructor.instructors:
  512. inst = instructor.instructors[instID]
  513. instSched = inst[4]
  514. courseID = str(input('enter the ID of the course you would like to add to their schedual.\n'))
  515. if courseID in course.courses:
  516. cour = course.courses[courseID]
  517. cour[5] = str(instID)
  518. instSched[courseID] = course.courses[courseID]
  519. print(instSched, cour[5],course.courses[courseID],'made it')
  520.  
  521.  
  522.  
  523. # admins
  524. Leigh = administrator('1001','Leigh','Brackett','administrator','Lb1001')
  525. Isaac = administrator('1002','Isaac','Asimov','administrator','Ia1002')
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538. # all of the courses
  539. CSCI1004 = course('CSCI1004','A Weakly Typical Python', '2016', 'fall', 'Pass Fail', '1004' )
  540. CSCI2004 = course('CSCI2004','The Objective of the Caml', '2016', 'fall', 'Normal','1004' )
  541. POLS2701 = course('POLS2701','The Meaning of the Constitution')
  542. HUMN2211 = course('HUMN2211','Living the Liberal Arts')
  543. PHIL3333 = course('PHIL3333','The Objective Truth' ,'2017','spring','Normal','1005')
  544. BIOS3791 = course('BIOS3791','Living System' )
  545. ENGR4792 = course('ENGR4792','Systems Living','2017','fall','normal','1005')
  546. PHIL4797 = course('PHIL4797','Living Systemically')
  547.  
  548.  
  549.  
  550. # given data
  551. #teachers
  552. Vandana.schedual['CSCI1004'] = course.courses['CSCI1004']
  553. Usman.schedual['PHIL3333'] = course.courses['PHIL3333']
  554. Usman.schedual['ENGR4792'] = course.courses['ENGR4792']
  555. #students
  556. Connie.schedual['CSCI1004'] = course.courses['CSCI1004']
  557. Kristine.schedual['CSCI1004'] = course.courses['CSCI1004']
  558. Gregory.schedual['CSCI1004'] = course.courses['CSCI1004']
  559. Carlos.schedual['CSCI1004'] = course.courses['CSCI1004']
  560. Nnedi.schedual['CSCI1004'] = course.courses['CSCI1004']
  561. Cartherynne.schedual['CSCI1004'] = course.courses['CSCI1004']
  562.  
  563.  
  564. Connie.schedual['PHIL3333'] = course.courses['PHIL3333']
  565. Kristine.schedual['PHIL3333'] = course.courses['PHIL3333']
  566. Gregory.schedual['PHIL3333'] = course.courses['PHIL3333']
  567. Carlos.schedual['PHIL3333'] = course.courses['PHIL3333']
  568. Nnedi.schedual['PHIL3333'] = course.courses['PHIL3333']
  569. Cartherynne.schedual['PHIL3333'] = course.courses['PHIL3333']
  570.  
  571. Connie.schedual['ENGR4792'] = course.courses['ENGR4792']
  572. Kristine.schedual['ENGR4792'] = course.courses['ENGR4792']
  573. Gregory.schedual['ENGR4792'] = course.courses['ENGR4792']
  574. Carlos.schedual['ENGR4792'] = course.courses['ENGR4792']
  575. Nnedi.schedual['ENGR4792'] = course.courses['ENGR4792']
  576. Cartherynne.schedual['ENGR4792'] = course.courses['ENGR4792']
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583. def login():
  584. global userID
  585. userID = str(input("Please enter your ID followed by the return key.\n"))
  586. password = str(input('Please enter your password followed by the return key.\n'))
  587. if userID in user.users:
  588. print('Checking')
  589. usercall = user.users[userID]
  590. userType = usercall[2]
  591. print(userType)
  592. if password == usercall[3]:
  593. print('Logedin as:',userType,usercall[0],usercall[1],userID)
  594. if userID in administrator.administrators :
  595. usercall = administrator.administrators[userID]
  596. User = administrator(userID,usercall[0],usercall[1],userType,usercall[3])
  597. main(User,userType)
  598. return userType
  599. elif userID in instructor.instructors:
  600. usercall = instructor.instructors[userID]
  601. schedule = usercall[4]
  602. print(schedule)
  603. User = instructor(userID,usercall[0],usercall[1],userType,usercall[3],schedule)
  604. print(schedule)
  605. main(User,userType)
  606. return userType
  607. elif userID in student.students:
  608. userType ='student'
  609. usercall = student.students[userID]
  610. schedule = usercall[4]
  611. User = student(userID,usercall[0],usercall[1],userType,usercall[3],schedule)
  612. main(User,userType)
  613. return userType
  614.  
  615.  
  616. else:
  617. print('Sorry ID or Password did not match please check you typed it in right and try again.\n')
  618. choice = str(input('Would you like to try again\n\
  619. [0]Yes\n\
  620. [1]No\n'))
  621. if choice == '0':
  622. login()
  623. elif choice =='1':
  624. pass
  625. else:
  626. print('Well that was not one of the optoins but we think that you ment No')
  627.  
  628. def main(User,userType):
  629. while True:
  630. if userType == 'student':
  631. choose = input('What do you wish to do? \n\
  632. [0] See what courses are going to be offered for a year and semester\n\
  633. [1] Print list of all courses\n\
  634. [2] Register for a course \n\
  635. [3] Print all of your grades\n\
  636. [4] Print a specific courses grades \n\
  637. [L] Logout / End session\n\
  638. [Q] Quit\n\n>>').upper()
  639. if choose == '0':
  640. User.search_course()
  641. elif choose == '1':
  642. User.print_courses()
  643. elif choose == '2':
  644. User.add_class()
  645. elif choose == '3':
  646. User.print_grades()
  647. elif choose == '4':
  648. User.print_class_grade()
  649. elif choose == 'Q':
  650. break
  651. elif choose =='L':
  652. login()
  653. break
  654.  
  655. if userType == 'instructor':
  656. choose = input('What do you wish to do? \n\
  657. [0] Print grades of all students in all courses in your schedule\n\
  658. [1] Print the grades the students in all your courses have\n\
  659. [2] Assing a studnet a grade\n\
  660. [3] See if a student is in one of your courses\n\
  661. [4] Print Roster \n\
  662. [5] Print schedule \n\
  663. [L] Logout / End session\n\
  664. [Q] Quit\n\n>>').upper()
  665. if choose == '0':
  666. User.print_all_course_grades()
  667. elif choose == '1':
  668. User.print_course_grades()
  669. elif choose == '2':
  670. User.class_grade_assign()
  671. elif choose == '3':
  672. User.see_if_student_in()
  673. elif choose == '4':
  674. User.print_roster()
  675. elif choose == '5':
  676. User.print_schedule()
  677. elif choose == 'Q':
  678. break
  679. elif choose =='L':
  680. login()
  681. break
  682.  
  683. if userType == 'administrator':
  684. choose = input('What do you wish to do? \n\
  685. [0] Assign an instructor a course\n\
  686. [1] Print out the grades that students have in all of a instructors courses\n\
  687. [2] Print out a particular students grades \n\
  688. [3] Print out all of grades for a particular course\n\
  689. [4] Change a students grade in a course \n\
  690. [5] Create a course \n\
  691. [6] Change a course \n\
  692. [7] Search for a course \n\
  693. [8] Batch assign al studnets in a particular course a grade \n\
  694. [L] Logout / End session\n\
  695. [Q] Quit\n\n>>').upper()
  696. if choose == '0':
  697. User.assign_inst_course()
  698. elif choose == '1':
  699. User.print_inst_grades()
  700. elif choose == '2':
  701. User.print_stud_grades()
  702. elif choose == '3':
  703. User.print_cl_grades()
  704. elif choose == '4':
  705. User.change_grade()
  706. elif choose == '5':
  707. User.creat_course()
  708. elif choose == '6':
  709. User.mod_course()
  710. elif choose == '7':
  711. User.search_course()
  712. elif choose =='8':
  713. User.class_grade_assign()
  714. elif choose == 'Q':
  715. break
  716. elif choose =='L':
  717. login()
  718. break
  719. login()
  720.  
  721. #Usman.student_assign_grade()
  722. #Usman.print_all_course_grades()
  723.  
  724. #Connie.print_grades()
  725. #print(Connie.schedual)
  726.  
  727.  
  728. '''
  729. Leigh.assign_inst_course()
  730. Leigh.print_inst_grades()
  731. Leigh.print_stud_grades()
  732. Leigh.print_cl_grades()
  733. Leigh.change_grade()
  734. Leigh.creat_course()
  735. Leigh.mod_course()
  736. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement