
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Language: Java
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 2 images

Knowledge Booster
Similar questions
- A palindrome is a word that is spelled the same way both forwards and backwards. For example, the word, 'racecar' is a palindrome. Using character arrays, write a c++ program that prompts the user to enter a word from the keyboard and informs the user whether the word is a palindrome or not.arrow_forwardASCIIarrow_forwardLISP Function help please LISP Programming only A function that generates a random day of the week, then displays a message saying that "Today is ... and tomorrow will be ...". Then use the built-in function random first to generate a number between 0 and 6 (including). The expression (random) by itself generates a random integer. You can call it with one parameter to return a value within the range from 0 to the value of the parameter-1. For example, (random 10) will return a value between 0 and 9. Next, use the number generated at the previous step to retrieve the symbol for the day of the week from the list. Use the built-in elt. Extract the symbol-name of the day first, then apply the built-in function capitalize to it. Use the result in the princ function call, and do the same thing for the next day. Make the function return true (t) instead of the last thing it evaluates, to avoid seeing the message printed more than once.arrow_forward
- Create a grading program in C as follows.- Ask the user for the number of students and store it in an integer variable.- Create an array of floats with four rows and columns equal to the number of students storedearlier.- Initialize the array to zeros.Create a menu with the following options (use a do-while loop and repeatedly display the menu):A or a to add student info one student at a timeT or t to display class average for homeworkS or s to display class average for quizzesB or b to display class average for examsZ or z to exit program (program repeats until this exit command is entered)The information for each student is: student number, homeworks grade, quizzes grade, and examsgrade.arrow_forwardThe following functions are all supposed to count how many times a certain base (represented as a character variable in Python) appears in a dna sequence (represented as a string variable in Python): def count1(dna, base): i = 0 for c in dna: if c == base: i += 1 return i def count2(dna, base): i = 0 for j in range(len(dna)): if dna[j] == base: i += 1 return i def count3(dna, base): match = [c == base for c in dna] return sum(match) def count4(dna, base): return dna.count(base) def count5(dna, base): return len([i for i in range(len(dna)) if dna[i] == base]) def count6(dna,base): return sum(c == base for c in dna) ======================================================================================= Which of them is correct? count 3, and count 6 only count 1, count 3, and count 4 only All of them are correct. count 1, count 3, count 4, and count 6 onlyarrow_forwardValidating User Input Summary In this lab, you will make additions to a Java program that is provided. The program is a guessing game. A random number between 1 and 10 is generated in the program. The user enters a number between 1 and 10, trying to guess the correct number. If the user guesses correctly, the program congratulates the user, and then the loop that controls guessing numbers exits; otherwise, the program asks the user if he or she wants to guess again. If the user enters a "Y", he or she can guess again. If the user enters "N", the loop exits. You can see that the "Y" or an "N" is the sentinel value that controls the loop. Note that the entire program has been written for you. You need to add code that validates correct input, which is "Y" or "N", when the user is asked if he or she wants to guess a number, and a number in the range of 1 through 10 when the user is asked to guess a number. Instructions Ensure the file named GuessNumber.java is open. Write loops…arrow_forward
- Kindly add comments /* Thank you!arrow_forwardUsing a Sentinel Value to Control a while Loop in Java Summary In this lab, you write a while loop that uses a sentinel value to control a loop in a Java program that has been provided. You also write the statements that make up the body of the loop. The source code file already contains the necessary variable declarations and output statements. Each theater patron enters a value from 0 to 4 indicating the number of stars the patron awards to the Guide’s featured movie of the week. The program executes continuously until the theater manager enters a negative number to quit. At the end of the program, you should display the average star rating for the movie. Instructions Ensure the file named MovieGuide.java is open. Write the while loop using a sentinel value to control the loop, and write the statements that make up the body of the loop to calculate the average star rating. Execute the program by clicking Run. Input the following: 0, 3, 4, 4, 1, 1, 2, -1 Check that the…arrow_forwardDescription Dot Product Task: Write a program that outputs the dot product of two given vectors. Your program should read the vectors from command line arguments, convert them to integers, output the vectors, and finally compute and output the resulting dot product. Let V and U be two vectors, where |V| we run the program as $ python dotproduct.py 156724 then the two vectors are V = [1, 5, 6] U = [7, 2, 4] and their dot product is calculated by V • U = (1 × 7) + (5 * 2) + (6 × 4) Example $ python dotproduct.py 1 23321 V = { 1, 2, 3 } U = {3, 2, 1 } V. U = 10 = ||U|= = 3 (the size of both vectors will always be 3). Ifarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY