Computers and Technology

Col 1 Col2 Col 3 Row 1 23.1 13.58 14
Row 2 56.783 46.29 45.71
Write a program that accomplishes the following objectives:
1. reads in the number of rows, then the number of columns,
2. using nested FOR loops, reads in the column data for each row,
3. adds up the data for each row and derives an average for each row,
4 also adds up all the data in the table and derives an overall average.
Hints
1. Look at slides 3 and 4 of CS1336_Lect5e_nested_loops. pptx and Pr5-14.cpp for samples of nested FOR loops, especially line 38 in slide 4 for a calculation of average per student. That is very much like a row average.
2 Have two running total variables, for example rowsum and totalsum. Initialize totalsum to 0 in the beginning of the program Initialize rowsum to 0 before the inner loop (see line 29 in slide 4). Keep running totals for both of these inside the inner loop (see line 36 in slide 4). Average the rowSum after each iteration of the inner loop (see line 38 in slide 4). Average the totalsum after the outside loop ends
When the input is as shown in Figure 1. your program should produce the output as shown in Figure 2.
Figure 1: (sample input) 23 23.1 13.58 14 56.783 46.29 45.71
Figure 2 (sample output) Lverage of data in row #1 is 16.89 Average of data in row #2 is 49.59 Average of all data is 33.24

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 16:30, jngonzo1226
Which of the following statements best describes it careers?
Answers: 2
image
Computers and Technology, 22.06.2019 22:50, youngboymark123
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
image
Computers and Technology, 23.06.2019 07:30, kimhoss2
What are ways to switch windows in excel? check all that apply. on the status bar, click the windows button, and then click the file name. on the task bar, click to display the excel jump list, and then click the file name. on the view tab, in the window group, click switch windows, and then click the file name. on the review tab, in the viewing group, click files, and then click the file name.
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, gamingisfun
Me ! evelyn is a manager in a retail unit. she wants to prepare a report on the projected profit for the next year. which function can she use? a. pmt b. round c. division d. what-if analysis
Answers: 2
Do you know the correct answer?
Col 1 Col2 Col 3 Row 1 23.1 13.58 14
Row 2 56.783 46.29 45.71
Write a program that ac...

Questions in other subjects:

Konu
Social Studies, 30.10.2020 23:40