
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 Illuminated
- Draw out the way each of these structs looks in memory, including padding! Number the offsets in memory. 1 struct okay Name 2 { short a; 3 4 long number; 5 int also_a_number; 6 7 }; char* text; 1 struct badName 2 { 3 4 5 }; short s; struct okay Name n;arrow_forwardYou can create your own AutoCorrect entries. Question 19Select one: True Falsearrow_forwardBy default, all text is formatted using the Normal Style. Question 20Select one: True Falsearrow_forward
- Node.js, Express.js, MongoDB, and Mongoose: Create, Read, Update, and Delete Operations There is a program similar to this assignment given as the last example, CRUD, in the lecture notes for the week that discusses the introduction to MongoDB. Basically, you need to adapt this example program to the data given in this assignment. This program will take more time that previous assignments. So, hopefully you'll start early and you've kept to the schedule in terms of reading the lecture notes. You can use compass if you want to create this database. Or, when your connection string in the model runs it will create the database for you if one does not yet exist. So, ⚫ create a Mongoose model based on the info given below. The index.html page is given in the same folder as these notes. • When you successfully run index.js and instantiate the model, your database is created. • Once the database is created, you need to perfect the addCar route so you can add data using the index.html page. •…arrow_forward1. Enabled with SSL, HTTPS protocol is widely used to provide secure Web services to Web users using Web browsers on the Internet. How is a secure communication channel established at the start of communication between a Web server running HTTPS and a Web browser? Consider the following threats to Web security and how each of these threats is countered by a particular feature of SSL. Man-in-the-middle attack: An attacker interposes during key exchange, acting as the client to the server and as the server to the client. Password sniffing: Passwords in HTTP or other application traffic are “eavesdropped.” SYN flooding: An attacker sends TCP SYN messages to request a connection but does not respond to the final message to establish the connection fully. The attacked TCP module typically leaves the “half-open” connection around for a few minutes. Repeated SYN messages can clog the TCP module.arrow_forwardSQL Injection on UPDATE Statement for educational purpose only Based on the information below how do i update this code in order to update the emplyees field, eg admin nickname, email,address, phone number etc? ' ; UPDATE users SET NickName='Hacked' WHERE role='admin' -- If a SQL injection vulnerability happens to an UPDATE statement, the damage will be more severe, because attackers can use the vulnerability to modify databases. In our Employee Management application, there is an Edit Profile page (Figure 2) that allows employees to update their profile information, including nickname, email, address, phone number, and password. To go to this page, employees need to log in first. When employees update their information through the Edit Profile page, the following SQL UPDATE query will be executed. The PHP code implemented in unsafe edit backend.php file is used to update employee’s profile information. The PHP file is located in the /var/www/SQLInjection directory.arrow_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





