C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 7.2, Problem 1E
(Practice) Write array declarations, including initializers, for the following:
a. A list of 10 integer voltages: 89, 75, 82, 93, 78, 95, 81, 88, 77, and 82
b. A list of five double-precision slopes: 11.62, 13.98, 18.45, 12.68, and 14.76
c. A list of 100 double-precision distances; the first six distances are 6.29, 6.95, 7.25, 7.35, 7.40, and 7.42
d. A list of 64 double-precision temperatures; the first 10 temperatures are 78.2, 69.6, 68.5, 83.9, 55.4, 67.0, 49.8, 58.3, 62.5, and 71.6
e. A list of 15 character codes; the first seven codes are f, j, m, q, t, w, and z
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
(JAVA)
Create a two-dimensional array of type double to contain the three different SD Marks (JD521, PRG521, and IP521) for six different students. A single array of type String must be used to store the student names (Maxwell, Carl, Gerhard, Paul, James, and Cena).
Allow a user to enter in a number, ranging from 1 to 6, which will represent the student position in the table MCSD max and present the marks for each respecting module. The program can only stop when the user enter a number greater than 6.
Printout the student name including the JD521, PRG521, and IP521 max, the total of marks and the average of all marks. Use a condition statement to decide that the student has passed or not (Pass rate is 70).
The programming language is java
Student name
JD521
PRG521
IPG521
Maxwell
80
65
70
Carl
95
70
65
Gerhard
87
80
73
Paul
65
45
60
James
45
87
65
(C++) PLEASE INCLUDE COMMENTS AND OUTPUT SCREEN
Write a program that will do the following:
In main, declare an array of size 20 and name it "randomArray." Use the function in step 2 to fill the array. Use the function in step 3 to print the array.
Create a function that generates 20 random integers with a range of 1 to 10 and places them into an array. Re-cycle the functions from Lab 10 where appropriate.
Make this a function.
There will be two arguments in the parameter list of this function: an array and the size of the array.
Within the function and the function prototype name the array: intArray.
Within the function and the function prototype name the size of the array: size.
The data type of the function will be void since the array will be sent back through the parameter list.
Bring in the function that generates and returns a random number that you created from the previous module. Call that function from this within the loop that adds random numbers to the…
(In Python)Complete the function separate_numbers, which takes in an array of numbers and a boolean value. It should return the number of even values in the array if the argument return_even is True, or the number of odd values in the array if return_even is False.
Hint: Use the count_evens function
Chapter 7 Solutions
C++ for Engineers and Scientists
Ch. 7.1 - (Practice) Write array declarations for the...Ch. 7.1 - (Practice) Write correct notation for the first,...Ch. 7.1 - Prob. 3ECh. 7.1 - (Practice) a. Write output statements using cout...Ch. 7.1 - (Desk check) List the elements displayed by the...Ch. 7.1 - (Practice) a. Write a program to input the...Ch. 7.1 - (Practice) Write a program to input eight integer...Ch. 7.1 - (Data processing) a. Write a program to input 10...Ch. 7.1 - Prob. 9ECh. 7.1 - (Electrical eng.) Write a program that specifies...
Ch. 7.2 - (Practice) Write array declarations, including...Ch. 7.2 - (Data processing) Write an array declaration...Ch. 7.2 - (Data processing) Write a program that uses an...Ch. 7.2 - (Electrical eng.) Write a program that stores the...Ch. 7.2 - (Practice) a. Write a declaration to store the...Ch. 7.3 - (Practice) Write specification statements for the...Ch. 7.3 - (Desk check) Determine the output produced by the...Ch. 7.3 - (Practice) a. Write a C++ program that adds the...Ch. 7.3 - (Practice) Write a C++ program that adds...Ch. 7.3 - Prob. 5ECh. 7.3 - (Electrical eng.) a. An engineer has constructed a...Ch. 7.4 - Prob. 1ECh. 7.4 - Prob. 2ECh. 7.4 - Prob. 3ECh. 7.4 - Prob. 4ECh. 7.4 - Prob. 5ECh. 7.4 - (Electrical eng.) Write a program that declares...Ch. 7.4 - (Statistics) Write a program that includes two...Ch. 7.5 - Prob. 1ECh. 7.5 - (Practice) Run Program 7.10 to determine the...Ch. 7.5 - Prob. 3ECh. 7.5 - (List maintenance) a. Write a complete C++ program...Ch. 7.5 - Prob. 5ECh. 7.5 - (List maintenance) The following letters are...Ch. 7.5 - (File creation) Write a C++ program that creates...Ch. 7.5 - Prob. 8ECh. 7.5 - Prob. 9ECh. 7.5 - Prob. 10ECh. 7.5 - Prob. 11ECh. 7.5 - Prob. 12ECh. 7.5 - Prob. 13ECh. 7.5 - Prob. 14ECh. 7.5 - Prob. 15ECh. 7.6 - Prob. 1ECh. 7.6 - Prob. 2ECh. 7.6 - Prob. 3ECh. 7.6 - Prob. 4ECh. 7.6 - Prob. 5ECh. 7.6 - Prob. 6ECh. 7.6 - Prob. 7ECh. 7.6 - Prob. 8ECh. 7.6 - (Practice) Use the max_element and min_element...Ch. 7 - (Statistics) a. Write a C++ program that reads a...Ch. 7 - (Practice) Define an array named peopleTypes that...Ch. 7 - (Numerical) Given a one-dimensional array of...Ch. 7 - (Numerical) Write and test a function that returns...Ch. 7 - (Sorting) Read a set of numerical grades from the...Ch. 7 - (Numerical) a. Define an array with a maximum of...Ch. 7 - (Numerical) Using the srand() and rand() C++...Ch. 7 - (Statistical) In many statistical analysis...Ch. 7 - (Data processing) Your professor has asked you to...Ch. 7 - (Modify) Modify the program written for Exercise 9...Ch. 7 - Prob. 11PPCh. 7 - (Data processing) The answers to a true-false test...Ch. 7 - Prob. 13PPCh. 7 - (Data processing) Construct a three-dimensional...Ch. 7 - (Computation) A magic square is a square of...Ch. 7 - (Computation) Among other applications, Pascal’s...
Knowledge Booster
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
- (in java) (with a screenshot of the code please) write a java program that contains 2 arrays, one for 10 students names and the other for their grades they must be all entered by the user -the names array will be a 1d array (single array) -the grades array will be a 2d array and it will have 3 rows and 10 columns, the first one is will represent the first exam, the second will represent the second exam, and the third one will represent the final exam finally, you will do a loop that will calculate the sum of all exams for each studentarrow_forward(PYTHON) (Display matrix of 0s and 1s) Write a function that displays an n-by-n matrix using the following header: def printMatrix(n): Each element is 0 or 1, which is generated randomly. Write a test program that prompts the user to enter n and displays an n-by-n matrix. Here is a sample run:arrow_forward(C PROGRAMMING ONLY) 2. Odd Lifeby CodeChum Admin In life, anything can happen. Yesterday we're happy, tomorrow we're sad. One moment we're up, the next we're down. Life's odd. But that's what makes it beautiful ? In this program, let's try displaying all the odd numbers of our array, life, but with the use of functions! Instructions: In the code editor, you are provided with an array called, life. Furthermore, in the main(), a function call was made to the function displayOdd() where the array life was passed as well as the size of life which is 90.Your task is to declare and define the function displayOdd() which has the following details:Return type - voidName - displayOddParametersint* - an arrayint - the size of the arrayDescription - displays all the odd numbers found in the array passed, starting from the end. Output Odd element at index 80: 33Odd element at index 77: 69Odd element at index 76: 17Odd element at index 73: 15Odd element at index 69: 101....arrow_forward
- (c++)1. Body Mass Index (BMI) is a measure of health on weight. It can be calculated by taking your weight in kilograms and dividing by the square of your height in meters. Write a program that lets a teacher to calculate the BMI of 20 students. The program should use three one dimensional arrays named studWeight that holds the weight (in kilograms), studHeight that holds the height (in meters) and studBMI that holds the calculated BMI for each student. The program contains the following functions: a) readData: This function receives the studWeight and studHeight arrays from the main function. It reads the weight and height for all the students and stored them in the studWeight and studHeight arrays, respectively. b) calBMI: This function receives one element of the studWeight and studHeight arrays. It calculates the BMI of each student based on her/his weight and height, and then store the BMI in the studBMI array. c) display: This function displays the BMI of the students.arrow_forward(Flattening arrays with flatten vs. ravel) Create a 2-by-3 array containing the first six powers of 2 beginning with 2^0. Flatten the array first with method flatten, then with ravel. In each case, display the result then display the original array to show that it was unmodified. Please use Python and keep it simple.arrow_forward(THIS IS FOR MINDTAP ON CENGAGE, PLEASE USE THAT. ALTERNATIVE IS DEVC++5.11 BUT HIGHLY RECOMMENDED THAT YOU USE MINDTAP) Instructions Write a C++ program that declares an array alpha of 50 components of type double. Initialize the array so that the first 25 components are equal to the square of the index variable (the position that element will occupy), and the last 25 components are equal to three times the index variable. Output the array so that 10 elements per line are printed. (For the number at index 5, the value would be 25, which is 5 squared. The 25th index would hold a value of 75, which is 3 * 25.) An example of the program output is shown below:arrow_forward
- (Sorting and Array in Ascending Order) Write a program that asks the user to input the number of elements of an integer array and its elements. The program then sorts the inputted array in ascending order. In C languagearrow_forward(python) prov_vac_status() takes a 2-D list (similar to the database) and an integer representing the province ID. This function returns three values; (i) the total number of unvaccinated patients, (i) the total number of partially vaccinated patients, and (i) the total number of fully vaccinated patients hospitalized in this province during the entire period. Note that these numbers include both the icu and the non-icu patients. >>> res1, res2, res3 = prov_vac_status(database, 12) >>> print(f"{res1}, {res2}, {res3}") >>> 194, 14, 118 >>> print(prov_vac_status(database, 35)) >>> (402, 28, 202) >>> print(prov_vac_status(database, 81)) >>> (0, 0, 0)arrow_forward(Check test scores) The answers to a true-false test are as follows: T T F F T. Given a two-dimensional answer array, in which each row corresponds to the answers provided on one test, write a function that accepts the two-dimensional array and number of tests as parameters and returns a one-dimensional array containing the grades for each test. (Each question is worth 5 points so that the maximum possible grade is 25.) Test your function with the following data: int score = 0;arrow_forward
- (Use Python) Use the Design Recipe to write a function called compute_commission that returns the commission earned by a salesperson for the sale of a car. The function should consume two parameters, first a string representing the model of the car sold and the second an int representing the number of extra features that were sold. The commission follows these rules: The commission earned on a basic model (“basic”) is $1000, on a mid-range model (“mid”) is $1500 and on a luxury model (“luxury”) is $2000. You may assume that these are the only three string values that will be passed to your function. The salesperson earns $100 per extra feature sold. You may assume the value for the extra features is always greater than or equal to zero. Include a docstring! Write 3 assert_equal statements to test your function.arrow_forward(Pointers + Dynamic 1D Arrays) c++ program please use only pointers and dynamic 1D array and please don't use recursion and vector or otherarrow_forwardPlease help! (Java) The objective is to write a program that reads CSV data and emits HTML data. Theprogram should accept input line-by-line in CSV format and produceoutput line-by-line in HTML format. You may use Scanners but should not need any otherimports. Note that regular expressions are forbidden.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Boolean Algebra - Digital Logic and Logic Families - Industrial Electronics; Author: Ekeeda;https://www.youtube.com/watch?v=u7XnJos-_Hs;License: Standard YouTube License, CC-BY
Boolean Algebra 1 – The Laws of Boolean Algebra; Author: Computer Science;https://www.youtube.com/watch?v=EPJf4owqwdA;License: Standard Youtube License