This feature will allow the form tutor or user to simply view all the students that have been stored in file. It will involve reading from the file and displaying the file contents for the user to see
Note: See if you can do better (and you should be able to). The solutions provided are basic, and allow for discussion on possible alternative methods and solutions.
#Form Tutor Management System import csv import sys def main(): login() def login(): username="formtutor" password="teacherypass" print("Enter username : ") answer1=input() print("Enter password : ") answer2=input() if answer1==username and answer2==password: print("Welcome - Access Granted") menu() def menu(): print("************MAIN MENU**************") #time.sleep(1) print() choice = input(""" A: Enter Student details B: View Student details C: Search by ID number D: Produce Reports Q: Quit/Log Out Please enter your choice: """) if choice == "A" or choice =="a": enterstudentdetails() elif choice == "B" or choice =="b": viewstudentdetails() elif choice == "C" or choice =="c": searchbyid() elif choice=="D" or choice=="d": producereports() elif choice=="Q" or choice=="q": sys.exit else: print("You must only select either A,B,C, or D.") print("Please try again") menu() def enterstudentdetails(): #user is prompted to input all the required fields print("Enter id") id=input() print("Enter first name") firstname=input() print("Enter surname") surname=input() print("Enter Date of Birth Format: dd/mm/yy") dob=input() print("Enter first line of address") firstlineaddress=input() print("Enter Postcode") postcode=input() print("Enter Gender") gender=input() print("Enter Tutor Group") tutorgroup=input() print("Enter email address") email=input() with open('studentfile.txt','a') as studentfile: studentfileWriter=csv.writer(studentfile) studentfileWriter.writerow([id,firstname,surname,dob,firstlineaddress,postcode,gender,tutorgroup,email]) print("Record has been written to file") studentfile.close() menu() def viewstudentdetails(): #Open the file for reading f=open("studentfile.txt","r",encoding="utf8") #Create a list called "displaylist" into which all the files lines are read in to.... displaylist=f.read() #print the list (that now has the file details in it) print(displaylist) f.close() menu() def searchbyid(): pass #Teacher can input an ID number and display the relevant student's details def producereports(): pass #Teacher can produce clever reports such as: #a) list of names of males and email addresses (to email a reminder about boys football club) #b) list of names of females in specific postcode (to remind them of a girls coding club in the area) #c) list of all names, birthdays and addresses (to send out birthday cards!) #the program is initiated, so to speak, here main()
Write your own summary of the problem. What are your objectives? List the success criteria
|Test No.||Description||Test Data(input)||Expected Outcome||Actual Outcome||Further Action?|