Imagine that you are managing a plant, and measure production each day. Production is in number of widgets, and you want a program that will let you enter in the number of widgets, and then tell whether for periods of time ranging from 1 day intervals to the maximum interval, whether the production is rising or falling. You want this to work for an arbitrary number of days. That is, you should be able to enter as many days as you want, and get a report as to days increasing or decreasing. For the input, make sure your program can collect thenumber of widgets for an arbitrary number of days. You can stop taking input when a user enters a negative number. Be sure to give a descriptive message telling what to input For the output, you want to report, for each possible interval from 1 day tothe maximum interval, what percentage of differences in widget production were increasing, and what percentage of intervals were decreasing (some could be the same). Print the output with 1 digit after the decima For example, if the widget production was entered for 5 consecutive days, and the production levels were 13, 15, 17, 15, 18, you might output something like:For 1-day intervals 75.0% were increasing and 25.0% were decreasingFor 2-day intervals 66.7% were increasing and 0.0% were decreasingFor 3-day intervals 100.0% were increasing and 0.0% were decreasingFor 4-day intervals 100.0% were increasing and 0.0% were decreasingThe first line is because outof the four one-day intervals, 13-15, 15-17, and 15-18 were increasing, while 17-15 was decreasing. The second line is becauseoutof the three two-day intervals, 13-17 and 17-18 were increasing, while 15-15 was neither increasing nor decreasing

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 21PE
icon
Related questions
Question

Imagine that you are managing a plant, and measure production each day. Production is in number of widgets, and you want a program that will let you enter in the number of widgets, and then tell whether for periods of time ranging from 1 day intervals to the maximum interval, whether the production is rising or falling. You want this to work for an arbitrary number of days. That is, you should be able to enter as many days as you want, and get a report as to days increasing or decreasing.

For the input, make sure your program can collect thenumber of widgets for an arbitrary number of days. You can stop taking input when a user enters a negative number. Be sure to give a descriptive message telling what to input

For the output, you want to report, for each possible interval from 1 day tothe maximum interval, what percentage of differences in widget production were increasing, and what percentage of intervals were decreasing (some could be the same). Print the output with 1 digit after the decima

For example, if the widget production was entered for 5 consecutive days, and the production levels were 13, 15, 17, 15, 18, you might output something like:For 1-day intervals 75.0% were increasing and 25.0% were decreasingFor 2-day intervals 66.7% were increasing and 0.0% were decreasingFor 3-day intervals 100.0% were increasing and 0.0% were decreasingFor 4-day intervals 100.0% were increasing and 0.0% were decreasingThe first line is because outof the four one-day intervals, 13-15, 15-17, and 15-18 were increasing, while 17-15 was decreasing. The second line is becauseoutof the three two-day intervals, 13-17 and 17-18 were increasing, while 15-15 was neither increasing nor decreasing. The third line is because both four-day intervals, 13-15 and 15-18, were increasing, and thefinal line is because the one four-day interval 13-18 was increasing.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
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