Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in python You are asked to create a simple database to save De Anza Students information. The registration office has provided a starting file input

in python

You are asked to create a simple database to save De Anza Students information.

The registration office has provided a starting file "input" with students info and grade scores.

You need to create a new file containing the same information along with the average score for each student.

Your program should also work if the registration office wants to add more students to the output file.

You should have at least the following functions:

readData(filename, studentList):

  • This function receives the file name and an empty list.
  • It reads in the information from the input file and updates the empty list with other lists containing students names, majors and scores.

checkGrade(num):

  • This function receives a score and returns the grade letter.
  • num >= 90, 'A' 80 <= num < 90, 'B' 70 <= num < 80, 'C' 60 <= num < 70, 'D' num < 60, 'F'

displayData(studentList):

  • This function reads input data from a list containing students names, majors, and score data.
  • displays student's data

- name, major, average and grade

Name Major Avg. Grade [Scores]

---------------------------------

Jacob CIS 86.8 B ['91', '83', '88', '85', '87']

Emily CIS 88.8 B ['86', '77', '91', '100', '90']

  • Note that this function calls checkGrade function.

showMenu():

  • This function displays the menu and returns the choice.

getData(studentList):

  • This function receives a list and prompts the user to enter data, the data will be appended to the list.

saveData(studentList) :

  • This function receives a linked list and writes the data to an output file.
  • - name, major, average and grade
  • Note that this function calls checkGrade function.

(ie) inside the file should be something like this

Name Major Avg. Grade [Scores]

---------------------------------

Jacob CIS 86.8 B ['91', '83', '88', '85', '87']

Emily CIS 88.8 B ['86', '77', '91', '100', '90']

The main function is provided for you and you are not supposed to change anything in it.

def main():

students = []

readData('input.txt', students)

displayData(students)

choice = showMenu()

while choice != 'Q' :

getData(students)

displayData(students)

choice = showMenu()

saveData(students)

main()

########################################################################

Sample run:

Name Major Avg. Grade [Scores]

---------------------------------

Jacob CIS 86.8 B ['91', '83', '88', '85', '87']

Emily CIS 88.8 B ['86', '77', '91', '100', '90']

Matthew ART 64.0 D ['71', '63', '67', '59', '60']

Ashley ART 94.4 A ['90', '100', '97', '93', '92']

Andrew CIS 50.0 F ['55', '43', '45', '51', '56']

Jessica CIS 70.2 C ['69', '85', '58', '70', '69']

Ryan BUSI 93.6 A ['97', '89', '98', '91', '93']

Sarah BUSI 84.6 B ['89', '91', '79', '81', '83']

John CIS 83.2 B ['76', '82', '91', '88', '79']

---------------------------------

------------------

  1. add new student data
  2. exit program

Select Menu : a

Enter name : Andy

Enter major : CIS

Enter 5 scores with comma(,) separated: 100,100,100,99,98

Name Major Avg. Grade [Scores]

---------------------------------

Jacob CIS 86.8 B ['91', '83', '88', '85', '87']

Emily CIS 88.8 B ['86', '77', '91', '100', '90']

Matthew ART 64.0 D ['71', '63', '67', '59', '60']

Ashley ART 94.4 A ['90', '100', '97', '93', '92']

Andrew CIS 50.0 F ['55', '43', '45', '51', '56']

Jessica CIS 70.2 C ['69', '85', '58', '70', '69']

Ryan BUSI 93.6 A ['97', '89', '98', '91', '93']

Sarah BUSI 84.6 B ['89', '91', '79', '81', '83']

John CIS 83.2 B ['76', '82', '91', '88', '79']

Andy CIS 99.4 A ['100', '100', '100', '99', '98']

---------------------------------

------------------

  1. add new student data
  2. exit program

Select Menu : A

Enter name : Sonia

Enter major : CIS

Enter 5 scores with comma(,) separated: 99,99,99,99,99

Name Major Avg. Grade [Scores]

---------------------------------

Jacob CIS 86.8 B ['91', '83', '88', '85', '87']

Emily CIS 88.8 B ['86', '77', '91', '100', '90']

Matthew ART 64.0 D ['71', '63', '67', '59', '60']

Ashley ART 94.4 A ['90', '100', '97', '93', '92']

Andrew CIS 50.0 F ['55', '43', '45', '51', '56']

Jessica CIS 70.2 C ['69', '85', '58', '70', '69']

Ryan BUSI 93.6 A ['97', '89', '98', '91', '93']

Sarah BUSI 84.6 B ['89', '91', '79', '81', '83']

John CIS 83.2 B ['76', '82', '91', '88', '79']

Andy CIS 99.4 A ['100', '100', '100', '99', '98']

Sonia CIS 99.0 A ['99', '99', '99', '99', '99']

---------------------------------

------------------

  1. add new student data
  2. exit program

Select Menu : w

Invalid Input

Select Menu

##############################################

input.txt -

Jacob,CIS,91,83,88,85,87

Emily,CIS,86,77,91,100,90

Matthew,ART,71,63,67,59,60

Ashley,ART,90,100,97,93,92

Andrew,CIS,55,43,45,51,56

Jessica,CIS,69,85,58,70,69

Ryan,BUSI,97,89,98,91,93

Sarah,BUSI,89,91,79,81,83

John,CIS,76,82,91,88,79

###############################################################################

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

hiagenaize he in possibler matvices 4 -2 - 3 4 9. 3 3.

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago