Advertisement
Guest User

Untitled

a guest
May 12th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.28 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. #prints the grades of a student
  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. #prints the grades that a students got in every course for a year and semester
  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
  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. # Prints what courses s tudent is taking
  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. # print all of the courses that a instructor is assigned for a given year and semester
  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.  
  198. if str(self.schedual[cl][2]) == clyear and str(self.schedual[cl][3]) == clsemester:
  199. print(self.schedual[cl])
  200.  
  201.  
  202. # prints the grades that students have in all of the courses that a instructor is assigned to
  203. def print_all_course_grades(self):
  204. courseFound = False
  205. gradeFound = False
  206. for cours in course.courses:
  207. cour = course.courses[cours]
  208. #print(cour[4])
  209. #print(self.ID)'
  210. if str(cour[4]) == self.ID:
  211. courseFound = True
  212. for stud in student.students:
  213. stu = student.students[stud]
  214.  
  215. if cours in stu[4]:
  216. gradeFound = True
  217. #print('1124124')
  218. print('------------')
  219. grad = stu[4]
  220. print(cours,':',cour[0],':',stu[0],':',grad[cours])
  221. if courseFound == False:
  222. print('Looks like you do not have any courses assigned to you\n')
  223. if gradeFound ==False:
  224. print('Looks like there are no students in any of your courses\n')
  225.  
  226. # Prints the grades that all students have in a course
  227. def print_course_grades(self):
  228. studentFound = False
  229. ClID = str(input('Enter the Course ID that you want to print.\n' ))
  230. ClYear = str(input('Enter the year you want to print.\n'))
  231. ClSemeter = str(input('Enter the semester you want to print.\n'))
  232. if ClID in self.schedual:
  233. cour = self.schedual[ClID]
  234. print(cour[1])
  235. print(cour[2])
  236. Cldata = cour
  237. Clyear = Cldata[1]
  238. Clsemester = Cldata[2]
  239. if ClYear == Clyear and ClSemeter == Clsemester:
  240. for stud in student.students:
  241. stu = student.students[stud]
  242. if ClID in stu[4]:
  243. studentFound = True
  244. print('------------')
  245. grad = stu[4]
  246. print(ClID,':',Clyear,':',Clsemester,':',Cldata[0],':',stu[0],':',grad[ClID])
  247. else:
  248. print('Looks like you infact do teach this class just not for this semester.\n')
  249. else:
  250. print('Sory you can only print the grades of courses that you are the assigned intructor of.\n')
  251.  
  252. if studentFound == False:
  253. print('Looks like there are no students taking this course.\n')
  254. # assigns grades to all students in a course
  255. def class_grade_assign(self):
  256. studFound = False
  257. print('This will change the grade of every student in the course.\n')
  258. option = str(input('Are you sure that you want to do this. please enter yes or no.\n'))
  259. if option.upper() == 'YES':
  260. Cl = str(input('Please enter the ID of the course that you would like to do a batch assign of grades to.\n'))
  261. if Cl in self.schedual:
  262. for ID in student.students:
  263. stud = student.students[ID]
  264. classGrades = stud[4]
  265. if Cl in classGrades:
  266. studFound = True
  267. print('student and course found.\n',ID)
  268. grade = str(input('Please enter the grade you would like this course to have.\n'))
  269. classGrades[Cl] = grade
  270. print('Grade change was successful')
  271.  
  272.  
  273. else:
  274. print('sory but you can only assign grades to students in classes that you teach\n')
  275. else:
  276. pass
  277. if studFound == False:
  278. print('We did not find any students in that course\n')
  279. # assigns a grade to a sigle student in a course
  280. def student_assign_grade(self):
  281. Cl = str(input('Please enter the ID of the course that you would like to do a batch assign of grades to.\n'))
  282. ID = str(input('Please enter the ID of the student you wish to assign or change the grade of.\n'))
  283. if Cl in self.schedual:
  284. if ID in student.students:
  285. stud = student.students[ID]
  286. classGrades = stud[4]
  287.  
  288. if Cl in classGrades:
  289. print('student and course found.\n')
  290. grade = str(input('Please enter the grade you would like this course to have.\n'))
  291. classGrades[Cl] = grade
  292. print('Grade change was successful')
  293. print(classGrades)
  294. else:
  295. print('We found a student with that ID but they do not seem to have that course in their schedule\n')
  296. else:
  297. print('There does not seem to be any student with that ID\n')
  298. else:
  299. print('Sorry but you can only assign/change the grade of students grades in courses that you are the teacher of.\n')
  300.  
  301.  
  302.  
  303.  
  304. #This is for testing
  305. """def print_schedual(self):
  306. ClYear = str(input('Enter the year you want to print.\n'))
  307. ClSemeter = str(input('Enter the semester you want to print.\n'))
  308. for ClID in self.schedual:
  309. cour = self.schedual[ClID]
  310. Cldata = cour
  311. Clyear = Cldata[1]
  312. Clsemester = Cldata[2]
  313. if ClYear == Clyear and ClSemeter == Clsemester:
  314. print(ClID,':',self.schedual[ClID],':',ClYear,':',Clsemester)
  315.  
  316. else:
  317. print('Looks like you do not have any classes for that year and semester')"""
  318. # checks to see if a student is taking a course offering
  319. def see_if_student_in(self):
  320. ClID = str(input('Enter the Course ID that you want to print (capitalize and integer).\n' ))
  321.  
  322. ClYear = str(input('Enter the year you want to print(enter as integer).\n'))
  323. # do not capitalize
  324. ClSemeter = str(input('Enter the semester you want to print (Do not capitalize).\n'))
  325. studentID = str(input('Enter the ID of the student you wish to see if they are in your class(Do not capitalize)'))
  326. studentFound = False
  327. if ClID in self.schedual:
  328. if studentID in student.students:
  329. if ClID in student.students[studentID][4]:
  330. sched = student.students[studentID][4]
  331. for Cl in sched:
  332. print(sched[Cl])
  333. cldata = sched[Cl]
  334. Clyear = cldata[1]
  335. Clsemester = cldata[2]
  336. if ClYear == str(Clyear) and ClSemeter == str(Clsemester):
  337. print(studentID,':',student.students[studentID][0],':',student.students[studentID][1],':','Is in your class',ClID,':','for the year',':',ClYear,':','and semester',':',ClSemeter)
  338. studentFound = True
  339. else:
  340. print('Looks like that student does not have that class for that year and semester\n')
  341. else:
  342. print('No student was found with that ID make sure you typed it in correctly\n')
  343. else:
  344. print('Sorry but you can only search courses that you are the instructor for\n')
  345. if studentFound == False:
  346. print('Student is not in that perticular course offering')
  347.  
  348. # print out the students in a course offering
  349. def print_roster(self):
  350. studentFound = False
  351. ClID = str(input('Enter the Course ID that you want to print (capitalize and integer).\n' ))
  352. ClYear = str(input('Enter the year you want to print(enter as integer).\n'))
  353. # do not capitalize
  354. ClSemeter = str(input('Enter the semester you want to print (Do not capitalize).\n'))
  355. if ClID in self.schedual:
  356. for studentID in student.students:
  357. if ClID in student.students[studentID][4]:
  358. sched = student.students[studentID][4]
  359. Clyear = sched[ClID][1]
  360. Clsemester = sched[ClID][2]
  361. if ClYear == str(Clyear) and ClSemeter == str(Clsemester):
  362. print(studentID,':',student.students[studentID][0],':',student.students[studentID][1],':','Is in your class',ClID,':','for the year',':',ClYear,':','and semester',':',ClSemeter)
  363. studentFound = True
  364. else:
  365. 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')
  366. if studentFound == False:
  367. print('Looks like there are not student taking that course\n')
  368.  
  369. # prints out what courses a instructor is assignd to for a year and semester
  370. def print_schedule(self):
  371. courseYear = str(input('Enter the year that you would like to take this course\n'))
  372. courseSemester = str(input('Enter the semester you would like to take this course\n'))
  373. courseFound = False
  374. for Cl in self.schedual:
  375. Clyear = self.schedual[Cl][1]
  376. Clsemester = self.schedual[Cl][2]
  377. if courseYear == str(Clyear) and courseSemester == str(Clsemester):
  378. courseFound = True
  379. print('You have course',Cl,courseYear,'for',courseSemester)
  380. if courseFound == False:
  381. print('You do not seem to have any courses for that year and semester')
  382.  
  383. # all of the instrucotrs
  384. Nancy = instructor('1003','Nancy','Kress','instructor','Nk1003')
  385. Vandana = instructor('1004','Vandana','Simgh','instructor','Vs1004')
  386. Usman = instructor('1005','Usman','Malik','instructor','Um1005')
  387.  
  388.  
  389. # instances are stored in administrators dict as well as user dict use str ID to query
  390. class administrator(user):
  391. # stores all the instances of administrators
  392. administrators = {}
  393.  
  394. def __init__(self, ID, firstName, lastName, userType, password):
  395. self.ID = ID
  396. self.fisrtName = firstName
  397. self.lastName = lastName
  398. self.userType= userType
  399. self.password = password
  400. # function that puts instances of administrator in administrators ditc user str ID to queryS
  401. administrator.administrators[self.ID]=[self.fisrtName,self.lastName,self.userType,self.password]
  402.  
  403. user.__init__(self, ID, firstName, lastName, userType, password)
  404. self.ID = ID
  405. self.fisrtName = firstName
  406. self.lastName = lastName
  407. self.userType= userType
  408. self.password = password
  409. # Creates a course
  410. def creat_course (self):
  411. ID = str(input('Please enter the course ID followed by the return key.\n'))
  412. name = str(input('Please enter the course name followed by the return key.\n'))
  413. year = str(input('Please enter the course year followed by the return key.\n'))
  414. semester = str(input('Please enter the course semester followed by the return key.\n'))
  415. gradeScale = str(input('Please enter the course gradeScale followed by the return key.\n'))
  416. instructor = str(input('Please enter the course instructor followed by the return key.\n'))
  417. course.courses[ID] = [name, year, semester, gradeScale, instructor]
  418. print(course.courses[ID])
  419.  
  420. # Modifies the atribuiltes of a course
  421. def mod_course(self):
  422. ID = str(input('Please enter the course ID followed by the return key.\n'))
  423. name = str(input('Please enter the course name followed by the return key.\n'))
  424. year = str(input('Please enter the course year followed by the return key.\n'))
  425. semester = str(input('Please enter the course semester followed by the return key.\n'))
  426. gradeScale = str(input('Please enter the course gradeScale followed by the return key.\n'))
  427. instructor = str(input('Please enter the course instructor followed by the return key.\n'))
  428. if ID in course.courses:
  429. modCourse = course.courses[ID]
  430. print('Course Found!!!!\n')
  431. if len(name) != 0:
  432. modCourse[0] = name
  433. print('Course name change was successful.\n')
  434. if len(year) != 0:
  435. modCourse[1] = year
  436. print('Course Year change was successful.\n')
  437. if len(semester) != 0:
  438. modCourse[2] = semester
  439. print('Course semester change was successful.\n')
  440. if len(gradeScale) != 0:
  441. modCourse[3] = gradeScale
  442. print('Course gradeScale change was successful.\n')
  443. if len(instructor) != 0:
  444. modCourse[4] = instructor
  445. print('Course instructor change was successful.\n')
  446.  
  447. print('Course Mods where successful.\n')
  448. print(ID,course.courses[ID])
  449.  
  450. else:
  451. 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')
  452.  
  453. # Changes the grade that a student has in a course
  454. def change_grade(self):
  455. ID = str(input('Please enter the ID of the student you wish to change the grade of.\n'))
  456. Cl = str(input('Please enter the course ID for the course you wish to change the grade.\n'))
  457.  
  458. if ID in student.students:
  459. stud = student.students[ID]
  460. classGrades = stud[4]
  461.  
  462. if Cl in classGrades:
  463. print('student and course found.\n')
  464. grade = str(input('Please enter the grade you would like this course to have.\n'))
  465. classGrades[Cl] = grade
  466. print('Grade change was successful')
  467. print(classGrades)
  468. # prints the grades that all the students have in a course
  469. def print_cl_grades(self):
  470. 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')
  471. courseID = str(input('Enter the ID of the course you would like to print all the grades of.\n'))
  472. ClYear = str(input('Enter the year you want to print(enter as integer).\n'))
  473. # do not capitalize
  474. ClSemester = str(input('Enter the semester you want to print (Do not capitalize).\n'))
  475. for ID in student.students:
  476. stud = student.students[ID]
  477. schedual = stud[4]
  478. if courseID in schedual:
  479. Cldata = schedual[courseID]
  480. Clyear = Cldata[1]
  481. Clsemester = Cldata[2]
  482. if ClYear == str(Clyear) and ClSemester == str(Clsemester):
  483. grade = schedual[courseID]
  484. name = stud[0:3]
  485. print(ID,name, grade)
  486. #self.schedual[courseID] = [course.courses[courseID], [courseID,grade]]
  487.  
  488. # prints out the grades of a signle student in all of there classes
  489. def print_stud_grades(self):
  490. stuID = str(input('Enter the Id of the student you want to print the grades of.\n'))
  491. if stuID in student.students:
  492. stu = student.students[stuID]
  493. print(stuID,':',stu[0],':',stu[1],':',stu[4])
  494.  
  495.  
  496. # prints the grades that students have in all of a signle instructors coures
  497. def print_inst_grades(self):
  498. instID = str(input('Enter the ID of the instructor you to print class grades of.\n'))
  499. if instID in instructor.instructors:
  500. inst = instructor.instructors[instID]
  501. instSched = inst[4]
  502. print(instSched)
  503. # assigns a course to an instructor
  504. def assign_inst_course(self):
  505. instID = str(input('Enter the ID the instructor you would like to assign a course to.\n'))
  506.  
  507. if instID in instructor.instructors:
  508. inst = instructor.instructors[instID]
  509. instSched = inst[4]
  510. courseID = str(input('enter the ID of the course you would like to add to their schedual.\n'))
  511. if courseID in course.courses:
  512. cour = course.courses[courseID]
  513. cour[5] = str(instID)
  514. instSched[courseID] = course.courses[courseID]
  515. print(instSched, cour[5],course.courses[courseID],'made it')
  516.  
  517.  
  518.  
  519. # admins
  520. Leigh = administrator('1001','Leigh','Brackett','administrator','Lb1001')
  521. Isaac = administrator('1002','Isaac','Asimov','administrator','Ia1002')
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534. # all of the courses
  535. CSCI1004 = course('CSCI1004','A Weakly Typical Python', '2016', 'fall', 'Pass Fail', '1004' )
  536. CSCI2004 = course('CSCI2004','The Objective of the Caml', '2016', 'fall', 'Normal','1004' )
  537. POLS2701 = course('POLS2701','The Meaning of the Constitution')
  538. HUMN2211 = course('HUMN2211','Living the Liberal Arts')
  539. PHIL3333 = course('PHIL3333','The Objective Truth' ,'2017','spring','Normal','1005')
  540. BIOS3791 = course('BIOS3791','Living System' )
  541. ENGR4792 = course('ENGR4792','Systems Living','2017','fall','normal','1005')
  542. PHIL4797 = course('PHIL4797','Living Systemically')
  543.  
  544.  
  545.  
  546. # given data
  547. #teachers
  548. Vandana.schedual['CSCI1004'] = course.courses['CSCI1004']
  549. Usman.schedual['PHIL3333'] = course.courses['PHIL3333']
  550. Usman.schedual['ENGR4792'] = course.courses['ENGR4792']
  551. #students
  552. Connie.schedual['CSCI1004'] = course.courses['CSCI1004']
  553. Kristine.schedual['CSCI1004'] = course.courses['CSCI1004']
  554. Gregory.schedual['CSCI1004'] = course.courses['CSCI1004']
  555. Carlos.schedual['CSCI1004'] = course.courses['CSCI1004']
  556. Nnedi.schedual['CSCI1004'] = course.courses['CSCI1004']
  557. Cartherynne.schedual['CSCI1004'] = course.courses['CSCI1004']
  558.  
  559.  
  560. Connie.schedual['PHIL3333'] = course.courses['PHIL3333']
  561. Kristine.schedual['PHIL3333'] = course.courses['PHIL3333']
  562. Gregory.schedual['PHIL3333'] = course.courses['PHIL3333']
  563. Carlos.schedual['PHIL3333'] = course.courses['PHIL3333']
  564. Nnedi.schedual['PHIL3333'] = course.courses['PHIL3333']
  565. Cartherynne.schedual['PHIL3333'] = course.courses['PHIL3333']
  566.  
  567. Connie.schedual['ENGR4792'] = course.courses['ENGR4792']
  568. Kristine.schedual['ENGR4792'] = course.courses['ENGR4792']
  569. Gregory.schedual['ENGR4792'] = course.courses['ENGR4792']
  570. Carlos.schedual['ENGR4792'] = course.courses['ENGR4792']
  571. Nnedi.schedual['ENGR4792'] = course.courses['ENGR4792']
  572. Cartherynne.schedual['ENGR4792'] = course.courses['ENGR4792']
  573.  
  574.  
  575.  
  576.  
  577.  
  578. # login
  579. def login():
  580. global userID
  581. name = str(input('Please Enter your first name.\n'))
  582. userID = str(input("Please enter your ID followed by the return key.\n"))
  583. password = str(input('Please enter your password followed by the return key.\n'))
  584. #checks if a user is in the dict
  585. if userID in user.users:
  586. print('Checking')
  587. usercall = user.users[userID]
  588. userType = usercall[2]
  589. # check password
  590. if password == usercall[3]:
  591. print('Logedin as:',userType,name,usercall[1],userID)
  592. #checks user type and pulls user info
  593. if userID in administrator.administrators :
  594. usercall = administrator.administrators[userID]
  595. #creats a new object with all the data
  596. User = administrator(userID,usercall[0],usercall[1],userType,usercall[3])
  597. main(User,userType)
  598. return userType
  599.  
  600. elif userID in instructor.instructors:
  601. usercall = instructor.instructors[userID]
  602. schedule = usercall[4]
  603. User = instructor(userID,usercall[0],usercall[1],userType,usercall[3],schedule)
  604. main(User,userType)
  605. return userType
  606. elif userID in student.students:
  607. userType ='student'
  608. usercall = student.students[userID]
  609. schedule = usercall[4]
  610. User = student(userID,usercall[0],usercall[1],userType,usercall[3],schedule)
  611. main(User,userType)
  612. return userType
  613.  
  614.  
  615. else:
  616. print('Sorry ID or Password did not match please check you typed it in right and try again.\n')
  617. choice = str(input('Would you like to try again\n\
  618. [0]Yes\n\
  619. [1]No\n'))
  620. if choice == '0':
  621. login()
  622. elif choice =='1':
  623. pass
  624. else:
  625. print('Well that was not one of the optoins but we think that you ment No')
  626. # the main program this is when you interact with the data
  627. def main(User,userType):
  628. while True:
  629. if userType == 'student':
  630. choose = input('What do you wish to do? \n\
  631. [0] See what courses are going to be offered for a year and semester\n\
  632. [1] Print list of all courses\n\
  633. [2] Register for a course \n\
  634. [3] Print all of your grades\n\
  635. [4] Print a specific courses grades \n\
  636. [L] Logout / End session\n\
  637. [Q] Quit\n\n>>').upper()
  638. if choose == '0':
  639. User.search_course()
  640. elif choose == '1':
  641. User.print_courses()
  642. elif choose == '2':
  643. User.add_class()
  644. elif choose == '3':
  645. User.print_grades()
  646. elif choose == '4':
  647. User.print_class_grade()
  648. elif choose == 'Q':
  649. break
  650. elif choose =='L':
  651. login()
  652. break
  653.  
  654. if userType == 'instructor':
  655. choose = input('What do you wish to do? \n\
  656. [0] Print grades of all students in all courses in your schedule\n\
  657. [1] Print the grades the students in all your courses have\n\
  658. [2] Asign all students in a course a grade\n\
  659. [3] See if a student is in one of your courses\n\
  660. [4] Print Roster \n\
  661. [5] Print schedule \n\
  662. [6] 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 == '6':
  678. User.student_assign_grade()
  679. elif choose == 'Q':
  680. break
  681. elif choose =='L':
  682. login()
  683. break
  684.  
  685. if userType == 'administrator':
  686. choose = input('What do you wish to do? \n\
  687. [0] Assign an instructor a course\n\
  688. [1] Print out the grades that students have in all of a instructors courses\n\
  689. [2] Print out a particular students grades \n\
  690. [3] Print out all of grades for a particular course\n\
  691. [4] Change a students grade in a course \n\
  692. [5] Create a course \n\
  693. [6] Change a course \n\
  694. [7] Search for a course \n\
  695. [8] Batch assign al studnets in a particular course a grade \n\
  696. [L] Logout / End session\n\
  697. [Q] Quit\n\n>>').upper()
  698. if choose == '0':
  699. User.assign_inst_course()
  700. elif choose == '1':
  701. User.print_inst_grades()
  702. elif choose == '2':
  703. User.print_stud_grades()
  704. elif choose == '3':
  705. User.print_cl_grades()
  706. elif choose == '4':
  707. User.change_grade()
  708. elif choose == '5':
  709. User.creat_course()
  710. elif choose == '6':
  711. User.mod_course()
  712. elif choose == '7':
  713. User.search_course()
  714. elif choose == 'Q':
  715. break
  716. elif choose =='L':
  717. login()
  718. break
  719. login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement