Beispiel #1
0
def enroll():
    display_courses(courses)
    course = int(input("Which one?"))
    foundCourse = searchId(courses, course)

    display_student(c1ass)
    student = int(input("Which student? "))
    foundStudent = searchId(c1ass, student)

    mark = Mark(foundCourse, foundStudent)
    foundCourse.c1ass.append(mark)
    foundStudent.courses.append(mark)
Beispiel #2
0
def addMark():
    NumMark=[]
    option= input("Type info  :")
        if (option == "info" ):
            ID = int(input("student ID:"))
            courseID  = int(input("course ID:"))
            Mark= int(input("the mark:"))
            m = Mark(ID,courseID,Mark)
            NumMark.append(m)
        if (option != "info"):
            print ("Error")
        else: break
Beispiel #3
0
 def input_mark():
     c_id=txt_couId.get()
     if (c_id=="") or (c_id  not in courseID):
             messagebox.showerror(message="Error: Please enter the Course ID")
     elif c_id in courseID:
         s_id=txt_stuId.get()
         if (s_id=="") or (s_id  not in studentID):
             messagebox.showerror(message="Error: Please enter the Student ID")
         elif s_id in studentID:
             score=float(txt_marks.get())
             if score<0 or score >20:
                 messagebox.showerror(message="Error: Please enter the mark in range(0,20)")
             else:
                 score=float(txt_marks.get())
                 mark = math.floor(score)
                 m = Mark(s_id,c_id,mark)
                 mark_detail.append(mark)
                 marks.append(m)
                 mark_screen.destroy()
Beispiel #4
0
def joinCourse():
    display(AllCourses)
    course = (int)(input("Select the course Id you want student to join: "))
    foundCourse = Course(0, "Null", 0)
    foundCourse = searchId(AllCourses, course)
    while not foundCourse:
        course = (int)(input("Course not found! Try again? "))
        foundCourse = searchId(AllCourses, course)

    display(AllStudents)
    student = (int)(
        input("Select the Id of the student will join this course: "))
    foundStudent = Student(0, "Null", "Null")
    foundStudent = searchId(AllStudents, student)
    while not foundStudent:
        student = (int)(input("Student not found? Try again? "))
        foundStudent = searchId(AllStudents, student)

    mark = Mark(foundCourse, foundStudent, foundCourse.Credit)
    foundCourse.StudentsList.append(mark)
    foundStudent.CoursesList.append(mark)
Beispiel #5
0
 def assign_mark():
     screen.addstr("Enter the courseID you want to input mark: ")
     c_id = (screen.getstr().decode())
     screen.clear()
     screen.refresh()
     if c_id in courseID:
         screen.addstr("Enter the StudentID you want to input mark: ")
         s_id=screen.getstr().decode()
         screen.clear()
         screen.refresh()
         if s_id in studentID:   
             while True:           
                 screen.addstr("Enter mark of this student in courses: ")
                 mark=math.floor(float(screen.getstr().decode()))
                 if mark<0 or mark>20:
                     curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)
                     try:
                         screen.addstr("Error!!!\n", curses.color_pair(1))
                     except curses.error:
                             pass
                     screen.refresh()
                     curses.napms(1000)
                     screen.clear()
                     screen.refresh()
                     screen.addstr("Please enter number in range (0,20): \n")
                     mark=math.floor(float(screen.getstr().decode()))
                 else:
                     break  
         else:
             exit()
     else:
         exit() 
     
     f = open('Marks.txt','a')
     f.write("CourseID: " + c_id + "\n" + "StudentID: " + s_id + "\n" + "Mark_detail: " + str(mark))
     f.close()
     
     mark_detail.append(mark)
     m = Mark(s_id,c_id,mark)
     marks.append(m)
Beispiel #6
0
def student_mark(s_count, s_list, c_count, c_list):
    outp.show_c_info(c_count, c_list)
    c_id = input("Choose the 'ID' of the course to update student mark : ")
    while True:
        if not any(course.id == c_id for course in c_list):
            c_id = input("No course found, please try again : ")
        else:
            break
    for i in range(len(c_list)):
        if c_list[i].id == c_id:
            c_name = c_list[i].name
            c_credit = c_list[i].credit
    print()
    print("Course : " + c_name)
    print("Update students marks from the list below :")
    outp.show_s_info(s_count, s_list)
    print()
    s_mark = []
    for i in range(s_count):
        course = c_name
        course_credit = c_credit
        s_id = input("Student ID : ")
        while True:
            if not any(student.id == s_id for student in s_list):
                s_id = input("No student found, please try again : ")
            else:
                break
        id = s_id
        for j in range(len(s_list)):
            if s_list[j].id == s_id:
                name = s_list[j].name
        m = float(input("Student Mark : "))
        mark = float(math.floor(m))
        s_mark.append(M.Mark(id, name, course, mark, course_credit))
        s_mark = sorted(s_mark, key=lambda x: x.id)
    return s_mark
Beispiel #7
0
    def mark_information():
        op.addstr("Enter the course id: ")
        cid = (op.getstr().decode())
        op.clear()
        op.refresh()
        if cid in courseID:
            op.addstr("Enter the student id: ")
            sid=op.getstr().decode()
            op.clear()
            op.refresh()
            if sid in studentID:   
                while True:           
                    op.addstr("Enter the marks: ")
                    value=math.floor(float(op.getstr().decode()))
                    if value<0 or value>10:
                        op.addstr("this mark does not exit!")
                    else:
                        break  
            else:
                exit()
        else:
            exit() 

        Mark(cid,sid,value)
Beispiel #8
0
screen.addstr("Enter number of courses: ")
ncourse = int(screen.getstr().decode())
for i in range(0, ncourse):
    c = Course("", "", "")
    c.input_cinfo()
    course_list.append(c)
    if len(course_list) == 0:
        f = open("courses.txt", "w")
    else:
        f = open("courses.txt", "a")
    f.write(c.getcid() + "\n" + c.getcname() + "\n" + str(c.getcredits()) + "\n")
    f.close()

screen.addstr("__________Input mark for each course____________ \n")

for j in range(len(course_list)):
    screen.addstr("for course {} \n".format(course_list[j].getcname()))
    for i in range(len(student_list)):
        mark = Mark(student_list[i], course_list[j], "")
        mark.inputmark()
        mark_list += [mark]
        if len(mark_list) == 0:
            f = open("marks.txt", "w")
        else:
            f = open("marks.txt", "a")
        f.write(mark.getstudent().getsname() + "\n" + mark.getcourse().getcname() + "\n" + str(mark.getmark()) + "\n")
        f.close()

    screen.clear()
    screen.refresh()
Beispiel #9
0
from domain.Student import *
from domain.Course import *
from domain.Mark import *
screen = curses.initscr()
screen.addstr("Enter number of students: ")
nstu = int(screen.getstr().decode())
for i in range(0, nstu):
    s = Student("", "", "", "")
    s.input_sinfo()
    student_list.append(s)

screen.addstr("Enter number of courses: ")
ncourse = int(screen.getstr().decode())
for i in range(0, ncourse):
    c = Course("", "", "")
    c.input_cinfo()
    course_list.append(c)

screen.addstr("__________Input mark for each course____________ \n")

for j in range(len(course_list)):
    screen.addstr("for course {} \n".format(course_list[j].getcname()))
    for i in range(len(student_list)):
        mark = Mark(student_list[i], course_list[j], "")
        mark.inputmark()
        mark_list += [mark]

    screen.clear()
    screen.refresh()