Homework Solution: In Python 2.7 Create the client and server programs for student information. The server program will provide functions to ad…

    In Python 2.7 Create the client and server programs for student information. The server program will provide functions to add/remove/modify student information and will hold that information in memory to keep it simple. The server will provide functions such as AddStudent(Id, Address, phone), RemoveStudent(id), ModifyStudent(..) etc. The client program will use RPC to call the various functions and display the results.

    Expert Answer

     
    HI thanks for asking . student_db.txt {'02': "tStudent Name: 'Shuvo Sarker' ntCGPA: '3.5' nt

    In Python 2.7 Create the client and server programs restraint ward instruction. The server program conquer agree functions to add/remove/modify ward instruction and conquer arrest that instruction in perpetuation to maintain it incomplex. The server conquer agree functions such as AddStudent(Id, Address, phone), RemoveStudent(id), ModifyStudent(..) controleseeing. The client program conquer authentication RPC to flatter the several functions and evince the results.

    Expert Rejoinder

     

    HI thankfulness restraint investigation .

    student_db.txt

    {’02’: “tWard Name: ‘Shuvo Sarker’ ntCGPA: ‘3.5’ ntTotal Credit Completed: ’52’ ntDate of Registration: ’20 May, 2016′ ntSession ends: ‘Spring 2020′ “, ’03’: “tWard Name: ‘Emon Ahmed’ ntCGPA: ‘3.5’ ntTotal Credit Completed: ’52’ ntDate of Registration: ’20 May, 2016′ ntSession ends: ‘Spring 2020′ “, ’01’: “tWard Name: ‘Ehsan Kamran’ ntCGPA: ‘3.5’ ntTotal Credit Completed: ’52’ ntDate of Registration: ’20 May, 2016′ ntSession ends: ‘Spring 2020′ “, ’06’: “tWard Name: ‘Choyon Ahmed’ ntCGPA: ‘3.5’ ntTotal Credit Completed: ’52’ ntDate of Registration: ’20 May, 2016′ ntSession ends: ‘Spring 2020′ “, ’07’: “tWard Name: ‘Habib Ahmed’ ntCGPA: ‘3.5’ ntTotal Credit Completed: ’52’ ntDate of Registration: ’20 May, 2016′ ntSession ends: ‘Spring 2020′ “, ’04’: “tWard Name: ‘Musa Nayem’ ntCGPA: ‘3.5’ ntTotal Credit Completed: ’52’ ntDate of Registration: ’20 May, 2016′ ntSession ends: ‘Spring 2020′ “, ’05’: “tWard Name: ‘Mehrab Hossain’ ntCGPA: ‘3.5’ ntTotal Credit Completed: ’52’ ntDate of Registration: ’20 May, 2016′ ntSession ends: ‘Spring 2020′ “, ’08’: “tWard Name: ‘Shahin Ahmed’ ntCGPA: ‘3.5’ ntTotal Credit Completed: ’52’ ntDate of Registration: ’20 May, 2016′ ntSession ends: ‘Spring 2020′ “, ’09’: “tWard Name: ‘Karim Miah’ ntCGPA: 3.0 ntTotal Credit Completed: 53 ntDate of Registration: ’20 December, 2015′ ntSession ends: ‘Spring 2019′ “, ’10’: “tWard Name: ‘Badshah Khan Bahadur’ ntCGPA: 3.9 ntTotal Credit Completed: 251 ntDate of Registration: ’20 September, 2013′ ntSession ends: ‘Spring 2017’ “}

    StudentDB.py

    print ‘Welcome to ward postulatesbase conduct program regulationd by Choyon’
    # Must keep ward_db.txt as postulatesbase resource
    # demo postulatesbase improve is mentioned in folder
    # Then fly the regulation to allow it achievement fine
    while True:
    try:
    file_temp = public(‘student_db.txt’, ‘r’)
    except IOError:
    print ‘To fly this program, you must keep ward_db.txt improve in the corresponding folder …n’
    ‘This program is regulationd and exposed by Choyon Ahmed’
    exit_prompt = input(‘Press enter/CTRL+C to arrest the window …n==> ‘)
    fetched_improve = eval(file_temp.read())
    try:
    print ‘Total Entries in postulatesbase:’, len(fetched_file.keys())
    command1 = raw_input(‘What you neglect me to do(cast the estimate. ex. 1)?n’
    ‘1. Update Ward Postulatesbasen’
    ‘2. View Full Ward Postulatesbasen’
    ‘3. Find a Ward by Flatten Estimaten==> ‘)
    if command1 == ‘1’:
    command2 = raw_input(‘1. Add Ward Postulatesn’
    ‘2. Delete Ward Postulatesn’
    ‘3. Serene Full Postulatesbasen==> ‘)
    if command2 == ‘1’:
    file_temp.close()
    file_edit_temp = public(‘student_db.txt’, ‘r’)
    file_edit = eval(file_edit_temp.read())
    file_edit_temp.close()
    key1 = raw_input(‘Enter New Ward Flatten Estimate: n==> ‘)
    print ‘Enter Ward postulates as asked :’
    student_name = ‘tWard Name: %r n’ % raw_input(‘Ward Name:n==> ‘)
    cgpa = ‘tCGPA: %r n’ % transport(raw_input(‘CGPA: n==> ‘))
    credit_complete = ‘tTotal Credit Completed: %r n’ % int(raw_input(‘Total Credit Completed: n==> ‘))
    join_date = ‘tDate of Registration: %r n’ % raw_input(‘Date of Registration: n==> ‘)
    expiration_date = ‘tSession ends: %r ‘ % raw_input(‘Session ends: n==> ‘)
    create_value = ward_name + cgpa + credit_complete + join_date + expiration_date
    file_edit[key1] = create_value
    file_edit_temp = public(‘student_db.txt’, ‘w’)
    file_edit_temp.write(‘%r’ % improve_edit)
    file_edit_temp.close()
    print ‘SYSTEM: Postulates Updated Successfully restraint ward flatten’, explanation1
    # This side is subordinate harvest.
    continue
    elif command2 == ‘2’:
    file_temp1 = public(‘student_db.txt’, ‘r’)
    file_temp2 = eval(file_temp1.read())
    file_temp1.close()
    key_to_delete = raw_input(‘Enter Ward Flatten estimate to delete: n==> ‘)
    try:
    del improve_temp2[key_to_delete]
    file_temp1 = public(‘student_db.txt’, ‘w’)
    file_temp1.write(‘%r’ % improve_temp2)
    file_temp1.close()
    print ‘Flatten estimate’, explanation_to_delete, ‘Has been deleted successfully!’
    continue
    except ExplanationError:
    print ‘ERROR: Ward Flatten Estimate is not attributable attributable attributable attributable attributable attributable assigned to the postulatesbase!’
    continue
    elif command2 == ‘3’:
    print ‘Are you certain neglect to serene the well postulatesbase?If you income, this action cannot attributable attributable be reverted ‘
    ‘back!’
    delete_confirm = raw_input(‘Cast Y to abide or N to abort the actionn==> ‘)
    if delete_confirm == ‘Y’:
    file_temp.close()
    file_temp = public(‘student_db.txt’, ‘w’)
    file_temp.write(‘{}’)
    file_temp.close()
    print ‘SYSTEM: Postulatesbase sereneed successfully!’
    continue
    elif delete_confirm == ‘N’:
    print ‘SYSTEM: Action Aborted …’
    continue
    else:
    print ‘SYSTEM: Invalid Command!’
    continue
    else:
    print ‘ERROR: Invalid Command!’
    continue
    elif command1 == ‘2’:
    checkme = len(fetched_file.keys())
    if checkme == 0:
    print ‘SYSTEM: There is no ward instruction stored in the postulatesbase!’
    continue
    else:
    restraint explanation in fetched_file:
    print ‘Flatten Estimate:’, explanation
    print fetched_file[key]
    continue
    elif command1 == ‘3’:
    while True:
    find_ward = raw_input(‘Cast ward flatten estimate :n==> ‘)
    try:
    print ‘Ward Instruction: n’, fetched_file[find_student]
    print ‘tFlatten estimate: %r’ % find_student
    # authority be bland with colossus past here later
    except ExplanationError:
    print ‘ERROR: Flatten estimate not attributable attributable attributable attributable attributable attributable set-up in the postulatesbase’
    continue
    else:
    print ‘ERROR: Invalid Command!’
    continue
    except ValueError:
    print ‘ERROR: Invalid Command!’
    continue

    Thanks