You will use sequential, selection and repetition programming statements. You will define one integer number: count count will store how many times valid weights and values have been entered. You will define a variety of doubles: weight, value, sum, sumw, avg value will store the input value weight will store the input weight for that value sum  will  store  the  running   sum  of  values  and weights sumw will store the running of the weights avg  will store  the weighted  average  of  the 5 numbers  and 5  weights  input. The running sum will be calculated by this formula: sum = sum + value * weight For  example, if   the  first value  and  weight  pair  entered  is 4, 1 and  second pair  is 10, 3: sum = sum + value*weight = 0 + 4*1 sum = 4 + 10*3 = 34 sumw = 1 + 3 = 4 Values and sum are to be input and calculated within a repetition loop: while count <  5 Input value, weight sumw = sumw + weight sum = sum + value * weight count = count + 1 End while Avg is calculated by: avg = sum / sumw You will use sequential, selection and repetition programming statements. You will define one integer number: count count will store how many times valid weights and values have been entered. You will define a variety of doubles: weight, value, sum, sumw, avg value will store the input value weight will store the input weight for that value sum  will  store  the  running   sum  of  values  and weights sumw will store the running of the weights avg  will store  the weighted  average  of  the 5 numbers  and 5  weights  input. The running sum will be calculated by this formula: sum = sum + value * weight For  example, if   the  first value  and  weight  pair  entered  is 4, 1 and  second pair  is 10, 3: sum = sum + value*weight = 0 + 4*1 sum = 4 + 10*3 = 34 sumw = 1 + 3 = 4 Values and sum are to be input and calculated within a repetition loop: while count <  5 Input value, weight sumw = sumw + weight sum = sum + value * weight count = count + 1 End while Avg is calculated by: avg = sum / sumw You will use sequential, selection and repetition programming statements   If weight >= 0 then sumw = sumw + weight sum = sum + value * weight count = count + 1 Else report error End If

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question

You will use sequential, selection and repetition programming statements.

You will define one integer number: count

count will store how many times valid weights and values have been entered.

You will define a variety of doubles: weight, value, sum, sumw, avg value will store the input value

weight will store the input weight for that value

sum  will  store  the  running   sum  of  values  and weights sumw will store the running of the weights

avg  will store  the weighted  average  of  the 5 numbers  and 5  weights  input.

The running sum will be calculated by this formula: sum = sum + value * weight

For  example, if   the  first value  and  weight  pair  entered  is 4, 1 and  second pair  is 10, 3: sum = sum + value*weight = 0 + 4*1

sum = 4 + 10*3 = 34 sumw = 1 + 3 = 4

Values and sum are to be input and calculated within a repetition loop:

while count <  5 Input value, weight

sumw = sumw + weight

sum = sum + value * weight

count = count + 1

End while

Avg is calculated by:

avg = sum / sumw

You will use sequential, selection and repetition programming statements.

You will define one integer number: count

count will store how many times valid weights and values have been entered.

You will define a variety of doubles: weight, value, sum, sumw, avg value will store the input value

weight will store the input weight for that value

sum  will  store  the  running   sum  of  values  and weights sumw will store the running of the weights

avg  will store  the weighted  average  of  the 5 numbers  and 5  weights  input.

The running sum will be calculated by this formula: sum = sum + value * weight

For  example, if   the  first value  and  weight  pair  entered  is 4, 1 and  second pair  is 10, 3: sum = sum + value*weight = 0 + 4*1

sum = 4 + 10*3 = 34 sumw = 1 + 3 = 4

Values and sum are to be input and calculated within a repetition loop:

while count <  5 Input value, weight

sumw = sumw + weight

sum = sum + value * weight

count = count + 1

End while

Avg is calculated by:

avg = sum / sumw

You will use sequential, selection and repetition programming statements

 

If weight >= 0 then sumw = sumw + weight

sum = sum + value * weight count = count + 1

Else

report error

End If

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Mathematical functions
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage