Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
Language: Python
1. The sample input will have to be in Text File (.TXT)
2. By using the first function, this
Transcribed Image Text:(A) https://www.freec X
wex Eligible Expenses X
Logout
I Form Shooting Pr X
Answered: Langu X
Bb Upload Assignme X
Bb CS170 Lab File, F X
Bb Syllabus 2021
blackboard.truman.edu/bbcswebdav/pid-1156029-dt-content-rid-14602527_1/courses/2021404103/CS170%20Lab%20File%20Function%20Grade.pdf
A
Paused
CS170 Lab File, Function, Grade
1 / 2
100%
+ |
Lab: Functions, Files, and Grades
This assignment should demonstrate the use of functions. By using the first function, this
program reads score and name values from a file. The program then determines the grade for
each students by using the second function. Finally, the program displays the name, score,
grade information on the console. The two functions are shown below:
and
1. def readFileValues(fileName):
# uses the fileName to prepare a file variable and open the file in read mode
# reads a line from the file and split the line into tokens in order to get score values
# stores the values in a scoreList variable
# reads the next line from the file and split the line into tokens to get name values
# stores the values in a nameList variable
# returns both of the two lists to the calling function
2. def calculateGrade(score):
# this function uses the score value to calculate the grade as the following:
# if the score is between 90 and 100 then the grade is A
# if the score is between 80 and 90 then the grade is B
# if the score is between 70 and 80 then the grade is C
# if the score is between 60 and 70 then the grade is D
# if the score is between 50 and 60 then the grade is E
# else the grade is F
# returns the calculated grade to the calling function
The main function uses the readFileValues to read the score values and name values in the
scoreList variable and nameList variable respectively. It then loops through the scoreList values
to calculate the letter grade of the students. Lastly, it displays the name, score, and the
calculated grade for each of the students. The sample input and output of the program are
shown below:
Sample Input
98.5
88
92.5
78.5
68.5
69
85
Sue
Joe
Ann
Deb
Bob
Esa
Cole
...
II
Transcribed Image Text:(A) https://www.freec X
wex Eligible Expenses X
Logout
I Form Shooting Pr X
Answered: Langu X
Bb Upload Assignme X
Bb CS170 Lab File, F X
Bb Syllabus 2021
blackboard.truman.edu/bbcswebdav/pid-1156029-dt-content-rid-14602527_1/courses/2021404103/CS170%20Lab%20File%20Function%20Grade.pdf
A
Paused
CS170 Lab File, Function, Grade
2 / 2
100%
+ |
Sample Input
98.5
88
92.5
78.5
68.5
69
85
Sue
Joe
Ann
Deb
Bob
Esa
Cole
Sample Output
Sue
98.5
A
Joe
88
В
Ann
92.5
A
Deb
78.5
C
Bob
68.5
Esa
69
Cole
85
В
The lab description comes with a skeleton program (a program that highlights the algorithm
and provides some code) that you can use to complete the assignment.
The deliverables for this assignment are the program file and a screenshot demonstrating one
sample run of the program.
When you are satisfied with your program, you can submit the deliverables on the blackboard
course website by Monday, July 26. Please let me know if you have any questions. Thanks.
...
II
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
Step by stepSolved in 3 steps with 3 images
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- program5_1.pyWrite a program that operates like a cashier terminal in a grocery store. It begins by prompting for the number of different items being purchased and then starts a loop. In the loop, the program should prompt for the item description, price and quantity of each item being purchased. These three values should be passed as arguments to a custom function that is defined in a separate module file. The imported function should print the subtotal for the item and return it to main. The total should be printed in main after the loop ends.arrow_forwardProgram - Python Create a simple text file called mycandy The first line of the file will be Candy Name, Candy Calories, Total Fat Grams Next, add five lines to the file by hand using your favorite five candy bars information. Each line's data will be separated by commas.arrow_forwardA photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names. Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output. Ex: If the input of the program is: ParkPhotos.txtand the contents of ParkPhotos.txt are:...arrow_forward
- C++ Visual Studio 2019 Write a program that asks the user for the name of a file. The program should display the contents of the file on the screen. Each line of screen output should be preceded with a line number, followed by a colon. The line numbering should start at 1. Here is an example: George Rolland 127 Academy Street Brasstown, NC 28706 If the file's contents won't fit on a single screen, the program should display 24 lines of output at a time, and then pause. Each time the program pauses, it should wait for the user to strike a key before the next 24 lines are displayed. Note: Save text below as the file to use and name it forChap12.txt file for this assignment. The line numbers should NOT be reset for each screen. Text: No one is unaware of the name of that famous English shipowner, Cunard. In 1840 this shrewd industrialist founded a postal service between Liverpool and Halifax, featuring three wooden ships with 400-horsepower paddle wheels and a burden of 1,162 metric...arrow_forwardUsing Pythonarrow_forwardC++ Visual 2019 A file called num.txt. write a C++ program that opens a file, reads all the numbers from the file and calculates the following: The number of numbers in the file The sum of all the numbers in the file (a running total) The average of all the numbers in the file The program should display the number of numbers found in the file, the sum of the numbers and the average of the numbers. These are the numbers in the num.txt file :...arrow_forward
- Systems Programming (COSC 330)Given a binary file containing the scores of 50 students in a class on Systems Programming course, compute the following statistics. Design the program such that the file should be specified as command line argument.1. Maximum score2. Min score3. Average score.4. Standard deviation5. Number of students who got an "A Grade (90 <= score <= 100)6. Number of students who got a "B" grade (80 <= score <90)7. Number of students who got a "C" grade (70 <= score <80)8. Number of students who got a "D" grade (60 <= score <70)9. Number of students failed (score < 60)Write a separate function in a separate file for each of the above and a header file and ‘scores.c’ for main function.Menu:1: for Max score, 2: for Min score, 3: ---- 9: for Number of students failed.10. for Exit, 0: for continue.The data file scores.dat is attached to the assignment. You may download the file and copy into Cygwin with the following command:cp...arrow_forwardPYTHON: I need to get the avg statement out of the loop so that the output prints correctly. Any suggestions. Write a program that reads the student information from a tab separated values (tsv) file. The program then creates a text file that records the course grades of the students. Each row of the tsv file contains the Last Name, First Name, Midterm1 score, Midterm2 score, and the Final score of a student. A sample of the student information is provided in StudentInfo.tsv. Assume the number of students is at least 1 and at most 20. The program performs the following tasks: Read the file name of the tsv file from the user. Open the tsv file and read the student information. Compute the average exam score of each student. Assign a letter grade to each student based on the average exam score in the following scale: A: 90 =< x B: 80 =< x < 90 C: 70 =< x < 80 D: 60 =< x < 70 F: x < 60 Compute the average of each exam. Output the last names, first names, exam...arrow_forwardFile Handling Assignment -2 Write a program to generate a file numbers.txt that contains the first 50 odd natural numbers and each line in the file should contain 5 numbers only. Attach the screenshot of numbers.txt. In C or C++arrow_forward
- Using Pythonarrow_forwardPYTHON PROGRAMMING LANGUAGE Create a new text document called names.txt (this is done by hand - not using programming) with the following names: Adam, Bryan, Charlie. Each name should be followed by a hard return (do not store them in a list). Main Function. Write a program where the user enters a name. Using the read function, check to see if the name is in the text document. If it is, respond back to the user the name is found within the list. Read Function. The read function should return the contents of the text document as a list. Write Function. The write function should take the list and override the file with the new names list in reverse alphabetical order with a hard return after each name. EXAMPLEPlease enter a name: AdamAdam is found in the list.Enter another name (Y/N): YPlease enter a name: AndrewSorry, Andrew was not found in the list. Would you like to add it? (Y/N): YAndrew has been added to the list.Enter another name (Y/N): N LIST EXAMPLEadambryancharlie Final...arrow_forwardjust do the first step. and the program should be in python and includ as many different functions as possible .arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education