Concept explainers
a.
Top-down design for calculating the average of ten test scores:
From the problem 54,
- Assign value to the given variables.
- Perform loop iteration for 10 times.
- Get the input from user.
- Compute the sum of 10 test scores.
- Increment the value of counter.
- Finally, find the average of 10 scores.
Example:
The example code for calculating average of ten scores is given below:
//Initialize count to 0
Set count to 0
//Initialize total to 0
Set total to 0
//Performs iteration for 10 times
WHILE (count < 10)
//Read the scores
Get mark
//Compute sum of test score
Set total to total + mark
//Performs increment for count
Set count to count + 1
//Print the result of average
Set average to total/10
Explanation:
The above code is used for calculating the average of ten scores using “WHILE” loop. In “WHILE” loop, the addition will perform until the score become greater than “10”.
b.
Top-down design for calculating the average of an unknown number of test scores:
- Assign value to the given variables.
- Performs iteration for n times.
- Get the input.
- Compute the sum of test scores for n scores.
- Increment the value of counter.
- Finally, determine the average of test scores.
Example:
The example code for calculating average of unknown number of scores is given below:
//Initialize count to 0
Set count to 0
//Initialize total to 0
Set total to 0
//Performs iteration for n times
WHILE (number of scores)
//Read the scores
Get mark
//Compute sum of test score
Set total to total + mark
//Performs increment for count
Set count to count + 1
//Print the result of average
Set average to total / count
Explanation:
The above code is used to compute the sum of score for “n” values using “WHILE” loop. In “WHILE” loop, the addition will perform until the score becomes greater than “n”.

Want to see the full answer?
Check out a sample textbook solution
Chapter 7 Solutions
COMPUTER SCIENCE ILLUMIN.-TEXT
- THIS IS NOT A GRADING ASSIGNMENT: Please only do lab 2.2 (bottom part of the first picture) For that Lab 2.2 do: *Part 1 *Part 2 *Part 3 I also attached Section 2.5.2 which is part of the step 1 so you can read what is it about. Thank you!arrow_forwardcan you please give me: * the code (step 3) *the list file (step 5) *and answer step 6 Thank youarrow_forward# Find the error# Why will the following code not print out a list of contact namesphoneBook = {'Doe, Jane' : '843-000-0000' ,'Doe, John' : '843-111-1111' ,'Smith, Adam' : '843-222-2222' ,'Jobs, Steve' : '999-333-3333' ,}for contact in phoneBook.values():print(contact)arrow_forward
- # Find the error:# The following code creates an empty dictionary and attempts to add a record# Why will the following code not create a new dictionary entry as intended?phoneBook = {}phoneBook{'Jobs, Steve'} = '999-111-1111'arrow_forwardSelect all the possible polar representations of the vector that is obtained from rotating where by Zrot Ź x = 3e² T= 3п 8 Hint: Consider the negative angle that is equivalent to the positive angle of the rotated vector. 0arrow_forwardCharacter Analysis If you have downloaded the source code you will find a file named text.txt on the Chapter 08 folder. Write a program that reads the file's contents and determines the following: The number of uppercase letters in the file The number of lowercase letter in the file The number of digits in the file The number of whitespace characters in the filearrow_forward
- Write a program that reads the text file's contents and calculates and outputs the following in this order: • The number of words in the file • The number of lines in the file • The number of uppercase letters in the file • The number of lowercase letters in the file • The number of digits in the file • The number of letter H's in the file • The number of whitespace characters in the file NOTE: Your program should include at least one try-except error handling statement block. Your program should also validate any input that could cause your program to crash. I'm Henery The Eighth, I Am! Henery The Eighth, I Am, I am!I got married to the widow next door,She's been married seven times before.And ev'ryone was a Henery,She wouldn't have Willie or a Sam.I'm her eighth old man named Henery,Henery the Eighth, I Am!Second verse same as the first!I'm Henery The Eighth, I Am! Henery The Eighth, I Am, I am!I got married to the widow next door,She's been married seven times before.And…arrow_forwardFigure 4-40 Modern Database Management, 13th edition, question 4-53arrow_forwardWhich of the following needs improvement in the dashboard shown? A. Instructional clarity missing for the views B. Filter placed at the top of the dashboard C. Inconsistent use of colors to represent missed goals D. Dashboard title too largearrow_forward
- If we click Show dashboard title in this dashboard, what will the title be?arrow_forwardPlease draw the diagram where it is asked to be drawn. Don't just describe how to do it.arrow_forwardC. Homework Assignment Task: Write a one-page CV using the provided template. Steps: 1. Use the CV guide to structure your CV. 2. Fill in each section with real information about yourself. 3. Format your CV neatly and use professional language. 4. Submit to the instructor before the next classarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





