Question

In: Computer Science

Create a python application that inputs, processes and stores student data. Specifications: 1. Your application should...

Create a python application that inputs, processes and stores student data.

Specifications: 1. Your application should be able to accept Student data from the user and add the information in a file type of your choice.

2. your application is a menu driven and allow the user to choose from the following menu

Menu: 1 – Add students to file

2 – print all the student information

3 – print specific student information using studentID

4 – Exit the program

2. Student Data should include the following • StudentID • FirstName • LastName • Major • Phone • GPA • Date of Birth

Example: C777777 James Bond CSAT 416-222-2222 3.88 October 15th, 1970

3. Your application should provide the functionality to display the student data as needed using student number key

4. Your application should calculate the average gpa of all the students and show the total gpa of the class along with the displayed student in previous step.

Solutions

Expert Solution

CODE:

#function to print the menu
def printMenu():
print('\n1. Add students to file')
print('2. Print all students information')
print('3. Print student information using studentId')
print('4. Exit program')
#function to add a student to the passed student dictionary
def addStudents(studentDict):
#asking the user of the inputs
iD = input('Enter the student id: ')
tempDict = {'fName':'','lName':'','major':'','phone':'','gpa':0.0,'dob':''}
tempDict['fName'] = input('Enter the first name of the student: ')
tempDict['lName'] = input('Enter the last name of the student: ')
tempDict['major'] = input('Enter the major: ')
tempDict['phone'] = input('Enter the phone number: ')
tempDict['gpa'] = float(input('Enter the gpa: '))
tempDict['dob'] = input('Enter the date of birth: ')
#adding the student to the dictionary
studentDict[iD] = tempDict
#returning the dictionary
return studentDict
#function to print the studentInfo
def printStudentInfo(studentDict,iD):
#forms an outString
outString = ""
outString += 'ID: '+iD+" "
outString += 'Name: '+studentDict['fName']+" "+studentDict['lName']+" "
outString += 'Major: '+studentDict['major']+" "
outString += 'Phone Number: '+studentDict['phone']+" "
outString += 'GPA: '+str(studentDict['gpa'])+" "
outString += 'Date of Birth: '+studentDict['dob']+" "
#returns a string with the formatted Data
return outString
#prints all the student in the passed dictionary
def printStudents(studentDict):
for i in studentDict.keys():
print("Id: "+i+" "+printStudentInfo(studentDict[i],i))
#asks the user to enter an Id
def printStudentSpecific(studentDict):
iD = input('Enter the id of the student: ')
#if the id is present in the list
if(iD in studentDict.keys()):
#the details are displayed
print(printStudentInfo(studentDict[iD],iD))
else:
print('Student with Id: {} not found!'.format(iD))
#function to calculate the sum and average of the gpa of the class
def displayAverageGpa(studentDict):
summation = 0
#calculating the sum
for i in studentDict.keys():
summation += studentDict[i]['gpa']
#displaying the average
print('Average GPA of students: {}'.format(str(round(summation/len(studentDict.keys()),2))))
print('Total GPA of students: {}'.format(str(round(summation,2))))
#main method
def main():
#a dictionary to store the information of all students in a class
studentDict = {}
#opening an output File
file = open('studentsInfo.txt','w')
while(True):
#asking the user to make a choice
printMenu()
choice = int(input('Enter a choice: '))
#according to the choice functions are called
if(choice == 1):
studentDict = addStudents(studentDict)
elif(choice == 2):
printStudents(studentDict)
elif(choice == 3):
printStudentSpecific(studentDict)
elif(choice == 4):
displayAverageGpa(studentDict)
#writing the student details in the file before exiting the code
for i in studentDict.keys():
file.writelines(printStudentInfo(studentDict[i],i)+"\n")
file.close()
print('Bye!')
break
else:
print('Invalid Option!')
#calling the main function
main()

___________________________________________

CODE IMAGES AND OUTPUT:

_________________________________________

OUTPUT:

_____________________________________________________

Feel free to ask any questions in the comments section
Thank You!


Related Solutions

General Requirements:           Create a Java application that inputs, processes and stores Employee data. Due date:...
General Requirements:           Create a Java application that inputs, processes and stores Employee data. Due date: Before 11:59:59PM on August 15th 2019. Specifications: 1. Your application should be able to accept Employee data from the user and add the information in a file type of your choice. 2. Employee Data should include the following EmployeeID FirstName LastName Department Phone Salary Example: 111222333 Percy Hayden Billing 416-222-2222 4000 3. Your application should provide the functionality to display the Employee data as...
Create an application containing an array that stores 5 integers. The application should call five methods...
Create an application containing an array that stores 5 integers. The application should call five methods from Array2 class that in turn (1) display all the integers, (2) display all the integers in reverse order, (3) display the sum of the integers, (4) display all values less than a limiting argument, and (5) display all values that are higher than the calculated average value. Save the file as ArrayTest.java.
Create a C structure which stores information about a student. Each student should be represented by...
Create a C structure which stores information about a student. Each student should be represented by a student ID (integer), first name, last name, day, month and year of birth, and program code (string). Write a C program which creates an array of 100 of these structures, then prompts the user to enter data from the keyboard to fill the array. If an ID of 0 is entered, data entry should finish, and the list of students should be printed...
Create a simple C++ application that will exhibit concurrencyconcepts. Your application should create two threads...
Create a simple C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0. For your created code, provide a detailed analysis of appropriate concepts that could impact your application. Specifically, address:Performance issues with concurrencyVulnerabilities exhibited with use of stringsSecurity of the data types exhibited.
Python Create a tkinter GUI application that has two buttons on it. The first button should...
Python Create a tkinter GUI application that has two buttons on it. The first button should have in red text the word "Red" on it and the second button should have in blue text the word "Blue" on it. When the red button is clicked you should change the background color of the application window to red and when the blue button is pressed you should change the background color of the application window to blue. You should place your...
Create a Java application that will exhibit concurrency concepts. Your application should create two threads that will act as counters.
JAVACreate a Java application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0.
Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters.
C++Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0.
Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters.
C++ application:Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0.For your created code, provide a written analysis of appropriate concepts that could impact your application.Please Specifically, Address: Performance Issues with Concurrency Vulnerabilities Exhibited with use of Strings and Security of the Data Types used.
Language: C# Create a new Console Application. Your Application should ask the user to enter their...
Language: C# Create a new Console Application. Your Application should ask the user to enter their name and their salary. Your application should calculate how much they have to pay in taxes each year and output each amount as well as their net salary (the amount they bring home after taxes are paid!). The only taxes that we will consider for this Application are Federal and FICA. Your Application needs to validate all numeric input that is entered to make...
Create a schema file that captures the requirements for a <student> element> Here are the specifications...
Create a schema file that captures the requirements for a <student> element> Here are the specifications for student: 3.1. A student must have a first name and last name. 3.2. A student may have a middle name, but it’s optional. 3.3. A student may have a home address, a work address, or both.             3.3.1. Use a complex type to connect to a single schema definition for “address” 3.4. An address has: a street address, city, state, and zip code....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT