Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, Please help me answering this question by using python. Overview For this assignment, you'll be reading grade data from a file, determining student letter

Hello,

Please help me answering this question by using python.

Overview

For this assignment, you'll be reading grade data from a file, determining student letter grades, and writing the results to a new file. The details for how your program should work are described in the Basic Requirements and Advanced Requirements sections below.

Input Data. A sample input data file of the type that your program should process is available here: sample_grade_input.txt. This sample file contains fake grade data for 14 students. However, your program should be able to work with a file with an arbitrary number of students. For example, I may test your program with just 3 students, or with 300. Your program should work for any length file.

Each student record spans 3 lines in the data file. The first line contains the type of student: GRAD or UNDERGRAD. This is important because graduate and undergraduate students get graded differently at UNC. The second line contains the student's name. The third line contains the student's overall numerical grade. Your program will need to map these to letter grades according to the following rules:

For the sake of this assignment, GRAD student grades are defined as follows:

Number Range Letter Grade
95-100 H
80-94 P
70-79 L
0-69 F

For the sake of this assignment, UNDERGRAD student grades are defined as follows:

Number Range Letter Grade
90-100 A
80-89 B
70-79 C
60-69 D
0-59 F

Output Data. Your program should write the results of its computations to an output file. An example of the required output file can be found here: sample_grade_output.txt. This sample file contains fake grade data for 14 students. Each student record spans 2 lines in the data file. The first line contains the student name. The second line contains the student's letter grade.

Basic Requirements

Your program should perform the following:

Prompt the user to enter the name of the input file, making sure that the file exists and asking the user to re-enter a filename if needed.

Prompt the user to enter the name of an output file. The output file should be erased/overwritten if an old one with the same name exists.

Read the input file, assign grades as appropriate for the type of student (GRAD vs. UNDERGRAD), and write the output to file.

Gracefully handle errors in the input file. In particular, your program should catch errors such as invalid numbers for grades, or student categories that are not "GRAD" or "UNDERGRAD". If found, the program should display an error message telling the user what the problem was. The program should then stop processing the rest of the data file and tell the user to fix the problems before retrying. During grading, your program will be tested with input files that have had errors intentionally introduced. It is suggested that you try this in your own testing to make sure that your program works as expected.

Two kinds of output should be produced by your program. First, an output data file should be created using the same format described in the "Output Data" paragraph of the Overview section above. Second, your program will produce output on the console in the form of status messages and prompts for user input. The output produced by your program should be nearly identical to the sample output provided below. While the specific data (names, grades, etc.) will vary based on the input provided, the data formats, prompts, and messages printed to the console when using your program should match those in the sample output files to receive full credit.

Please Note: Your program should use the flow control and conditional constructs that have been discussed in class to "stop processing the rest of the data file." In this way, the program should continue to run until the end, with your logic telling the program what to do (or what not to do). You should NOT use any special Python functions to "immediately stop" your program (e.g., using sys.exit() or a similar function is not allowed).

An example of the output produced by my solution to this assignment can be found here

Please enter the name of the input data file: grade_input.txt Please enter the name of the output data file: grade_output.txt Would you like to curve the grades? (Y/N) n All data was successfully processed and saved to the requested output file.

An example of the data output file is available here.

Old Jane L Old David P Old Anne H Old John F Old Peter F Old Beth P Old Alice P Young Jane B Young David C Young Anne D Young John A Young Peter F Young Beth A Young Alice D

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_2

Step: 3

blur-text-image_3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2019 Wurzburg Germany September 16 20 2019 Proceedings Part 2 Lnai 11907

Authors: Ulf Brefeld ,Elisa Fromont ,Andreas Hotho ,Arno Knobbe ,Marloes Maathuis ,Celine Robardet

1st Edition

3030461467, 978-3030461461

Students also viewed these Databases questions

Question

5. Do you have any foreign language proficiency?

Answered: 1 week ago