bartleby

Concept explainers

Question
Book Icon
Chapter 7, Problem 4PP
Program Plan Intro

Program Plan:

  • Include the appropriate headers into program.
  • Declare and define the constant variable “LEN”.
  • Declare the appropriate functions.
  • Define the “main()” function.
    • Declare the array variable “arr[]” in type of double.
    • Declare the variables “stdDeviation” and “avg” in type of double.
    • Declare the variable “ans” in type of character.
    • Using “do…while” loop, prompt the user for array values.
      • Call the function “stdDev()” which passes array and size of array and store the result in “stdDeviation”.
      • Prompt and get the sentinel value from user.
      • Check the loop with condition for sentinel value.
    • Return “0” to called function.
  • Define the function named “stdDev()” which passes the arguments “arr[]” in type of character and “size” in type of integer.
    • Declare and initialize the “sumSquares” in type of “double”.
    • Call the function “average()” which passes array and size of array as arguments and stores the result in “avg” variable.
    • Using “for” loops, calculate the summation value.
    • Return the square root of summation value.
  • Define the function named “average()” which passes “arr[]” and “size”  as arguments.
    • Declare and initialize the “sum” in type of “double”.
    • Using “for” loop, calculate the total of array values.
    • Return the average of array values.

Blurred answer
Students have asked these similar questions
We have a list that stores the repeated heart-rate measurements for the same patient over several tests. Each inner-list is a test and for that test, the heart rate is monitored for some time while taking a few measurements. Next, we would like to calculate the average of the measurements for each test.heart_rate = [ [ 72, 75, 71, 73], # resting[ 91, 90, 94, 93], # walking slowly[ 130, 135, 139, 142], # running on treadmill[ 120, 118, 110, 105, 100, 98]] # after minute recoveryIn your code, define a function calculate_average_heart_rates() that accepts the list heart_rate as its only input argument. Inside the function, use nested loops to calculate the average heart rate during each test scenario. This function should return a list that contains the average heart rate values of a patient for the four test scenarios.Write unit tests
There are n professors in a university, and these professors teach m, and there are k classrooms. Find the model that creates the appropriate curriculum with different numbers of n, m, k, write the code and calculate its time complexity
A finite sequence of symbols from a given alphabet will be called a string over the alphabet. A string that consists of a sequence a1, a2, a3, a4, … … … … , an of symbols will be denoted by the juxtaposition a1 a2 a3 a4 … … … … an. Given the strings: u = a2bab2and v = bab2, Evaluate the following operations for strings: (i) ԑu(ii) u + v(iii) u(u| v)(iv) v | (v | u)

Chapter 7 Solutions

Problem Solving with C++, Student Value Edition Plus MyLab Programming with Pearson eText - Access Card Package (10th Edition)

Ch. 7.2 - Consider the following function definition: void...Ch. 7.2 - Prob. 12STECh. 7.2 - Write a function definition for a function called...Ch. 7.2 - Consider the following function definition: void...Ch. 7.2 - Insert const before any of the following array...Ch. 7.2 - Write a function named outOfOrder that takes as...Ch. 7.3 - Write a program that will read up to ten...Ch. 7.3 - Write a program that will read up to ten letters...Ch. 7.3 - Following is the declaration for an alternative...Ch. 7.4 - Prob. 20STECh. 7.4 - Write code that will fill the array a (declared...Ch. 7.4 - Prob. 22STECh. 7 - Write a function named firstLast2 that takes as...Ch. 7 - Write a function named countNum2s that takes as...Ch. 7 - Write a function named swapFrontBack that takes as...Ch. 7 - The following code creates a small phone book. An...Ch. 7 - There are three versions of this project. Version...Ch. 7 - Hexadecimal numerals are integers written in base...Ch. 7 - Solution to Programming Project 7.3 Write a...Ch. 7 - Prob. 4PPCh. 7 - Write a program that reads in a list of integers...Ch. 7 - Prob. 6PPCh. 7 - An array can be used to store large integers one...Ch. 7 - Write a program that will read a line of text and...Ch. 7 - Write a program to score five-card poker hands...Ch. 7 - Write a program that will allow two users to play...Ch. 7 - Write a program to assign passengers seats in an...Ch. 7 - Prob. 12PPCh. 7 - The mathematician John Horton Conway invented the...Ch. 7 - Redo (or do for the first time) Programming...Ch. 7 - Redo (or do for the first time) Programming...Ch. 7 - A common memory matching game played by young...Ch. 7 - Your swim school has two swimming instructors,...Ch. 7 - Your swim school has two swimming instructors,...Ch. 7 - Prob. 19PPCh. 7 - The Social Security Administration maintains an...
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
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