Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

9.8 Module 7 ZyLab - Student Scores(PYTHON) For this lab, you will complete a program that allows a teacher to enter the first name and

9.8 Module 7 ZyLab - Student Scores(PYTHON)

For this lab, you will complete a program that allows a teacher to enter the first name and a test score for the students in his or her class. Assume that the teacher has already entered the names and test scores of some of the students in the class and have stored this information in a text file called student_scores.txt. The contents of that file resembles the following example below.

(Example text file)

James 88 Ronda 92 Benjamin 85 Sarah 97 Frank 89 

The program will allow the teacher to add student scores, delete student scores, and display all student scores. All of this information must be maintained in the student_scores.txt file so that the teacher can access this information at any time; even after the application has closed. Your program must contain a menu and three additional functions to the main; addStudentScores(), deleteStudentScores(), and displayStudentScores.

(1) Display a program header and the user menu to allow the user to make a menu selection. The program must repeat until the user selects option 4 to exit the program. (10 points)

Ex.

Student Test Score Entry Program -------------------------------- 1. Add Student Score 2. Delete Student Score 3. Display Student Scores 4. Exit Program Enter Selection: 4 The program will now exit! 

(2) Write an addStudentScores() function that allows the teacher to add any number of student scores to the file. The program should ask the teacher how many student scores to enter, then append the text file with the appropriate number of student test scores. A confirmation message should also appear to confirm that the new student scores have been added to the file. Note that all new scores must follow the same format that already exists in the text file with the student name and test score on the same line. (15 points)

Ex.

Student Test Score Entry Program -------------------------------- 1. Add Student Score 2. Delete Student Score 3. Display Student Scores 4. Exit Program Enter Selection: 1 Number of student scores to enter: 2 Enter student's name: Mary Enter student's test score: 97 Enter student's name: Brian Enter student's test score: 79 New test scores saved to file! 

(3) Write a deleteStudentScores() function that allows a teacher to enter only the name of a student and have that student and his or her score deleted from the file. A message of Student not found! should be displayed if the teacher enters a name of a student not in the text file. Or a message of [StudentName] has been deleted from the file! should be displayed to confirm that the student has been deleted from the text file. (15 points) Hints:

You will need to read from and write to the file.

Think about using a Boolean to determine if the name is present in the file.

Think about whether you need to confirm how the teacher enters the student's name.

Remember that the student's name is only contained in the first part of each line.

Ex.

Student Test Score Entry Program -------------------------------- 1. Add Student Score 2. Delete Student Score 3. Display Student Scores 4. Exit Program Enter Selection: 2 Enter the student's name to delete: Ronald Student not found! 1. Add Student Score 2. Delete Student Score 3. Display Student Scores 4. Exit Program Enter Selection: 2 Enter the student's name to delete: Sarah Sarah has been deleted from the file! 

(4) Write a displayStudentScores() function that allows the teacher to display all of the student scores in the text file. (10 points)

Ex.

Student Test Score Entry Program -------------------------------- 1. Add Student Score 2. Delete Student Score 3. Display Student Scores 4. Exit Program Enter Selection: 3 Student Scores -------------- James 88 Ronda 92 Benjamin 85 Frank 89 Mary 97 Brian 79 

(PYTHON)(PYTHON)(PYTHON)(PYTHON)(PYTHON)(PYTHON)

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

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

Students also viewed these Databases questions

Question

LO 41-1 What are the humanistic approaches to treatment?

Answered: 1 week ago

Question

Discuss the goals of financial management.

Answered: 1 week ago