Question

In: Computer Science

A bug collector collects bugs every day for seven days. Design a program that keeps a...

A bug collector collects bugs every day for seven days. Design a program that keeps a running total of the number of bugs collected during the seven days. The loop should ask for the number of bugs collected for each day, and when the loop is finished, the program should display the total number of bugs collected. Finally, compute and display the average number of bugs collected. You should have 2 functions defined:

  • A main – control program flow
  • A collectBugInfo – prompt user for bug info, compute total and average

Write the Pseudocode OR a raptor flowchart for the Bug Collector program described above.

Solutions

Expert Solution

Here there are two functions

one is main function and the other is the collectBugInfo function

We collect BugInfo of 7 days and calculate total bugs and average of them in collectBugInfo function

After creating this two flowcharts press function key f10 to execute step by step.

When the input box comes it will pop a window to enter bug of each day.

After 7 days are finished it will calculate sum and average and print them and ends

(Start executing from main flowchart)

main function flowchart using raptor:

collectBugInfo function flowchart:

Here I entered 2,4,6,8,10,12,14 as the bugs from day 1 to 7

SO the total bugs here are 56 and average of bugs is 56/7 = 8

O/P:


Related Solutions

A bug collector collects bugs every day for five days. Write a program that keeps a...
A bug collector collects bugs every day for five days. Write a program that keeps a running total of the number of bugs collected during the five days. The loop should ask for the number of bugs collected for each day, and when the loop is finished, the program should display the total number of bugs collected. need this in Python
Need a java code A bug collector collects bugs every day for 7 days. Write a...
Need a java code A bug collector collects bugs every day for 7 days. Write a program that keeps a running total of the number of bugs collected during the 7 days. The program should prompt the user to enter the number of bugs collected for each day. Finally, when the program is finished, the program should display the total number of bugs collected.
A grocery store is open 24 hours a day, seven days a week. It has the...
A grocery store is open 24 hours a day, seven days a week. It has the following daily requirements for cashiers: Time                             Minimum # of cashiers 0100 – 0400                              7 0400 – 0700                              4 0700 – 1000                              9 1000 – 1300                              12 1300 – 1600                              15 1600 – 1900                              17 1900 – 2200 19 2200 – 0100                              13 A cashier may start work at the beginning of any one of the shifts and, having begun, works 9 consecutive hours. Each...
Design and implement an interactive program named trip.c that collects information about the user's car and...
Design and implement an interactive program named trip.c that collects information about the user's car and planned travel, and reports back useful information. The dialog below shows exactly what data should be collected as input and reported as output. Some Hints to get started /* Not tested not complete code Just to get you started */ #include /* FUNCTION PROTOTYPES */ void WelcomeMessage(); void AskUserForInput(); /* ask and check whether user wants to continue if wants to continue gather information...
Clancy’s Casino, in Muledeer, Nevada, is open 24 hours a day, seven days a week. Along...
Clancy’s Casino, in Muledeer, Nevada, is open 24 hours a day, seven days a week. Along with all the other attractions and diversion, Clancy’s operates a variety of gaming tables. Dealers at these tables are interchangeable. The casino has the following daily requirements for dealers:                   Time                             Minimum # of dealers       0100 – 0500                               7       0500 – 0900                               4       0900 – 1300                               9       1300 – 1700                               12       1700 – 2100                               15       2100 – 0100                              ...
You eat five days per week at the same restaurant, and every day you order a...
You eat five days per week at the same restaurant, and every day you order a sandwich and a drink. There are 26 sandwiches including 6 vegetarian options, and 15 drinks including 4 caffeine-free drinks. On Tuesdays, you like to eat healthy, so you always choose a vegetarian sandwich and a caffeine free drink on Tuesdays. The other days you can eat any sandwich and drink any drink - but you never repeat a sandwich or a drink in the...
You eat five days per week at the same restaurant, and every day you order a...
You eat five days per week at the same restaurant, and every day you order a sandwich and a drink. There are 26 sandwiches including 6 vegetarian options, and 15 drinks including 4 caffeine-free drinks. On Tuesdays, you like to eat healthy, so you always choose a vegetarian sandwich and a caffeine free drink on Tuesdays. The other days you can eat any sandwich and drink any drink - but you never repeat a sandwich or a drink in the...
You eat five days per week at the same restaurant, and every day you order a...
You eat five days per week at the same restaurant, and every day you order a sandwich and a drink. There are 20 sandwiches including 6 vegetarian options, and 14 drinks including 4 caffeine-free drinks. On Tuesdays, you like to eat healthy, so you always choose a vegetarian sandwich and a caffeine free drink on Tuesdays. The other days you can eat any sandwich and drink any drink - but you never repeat a sandwich or a drink in the...
Sally is tracking her spending. Every day for n days, Sally tracks the exact amount of...
Sally is tracking her spending. Every day for n days, Sally tracks the exact amount of dollars he spends that day, which is a nonnegative real number but not necessarily an integer. For positive integers i ≤ n, he spends xi dollars on day i. For example, on day 1, he spends x1 dollars. At the end of the n days, he calculates the average daily amount he spends on his food to be averagex = (x1 + x2 +...
Design a Python program to prompt the user for temperatures for ten consecutive days in Celsius...
Design a Python program to prompt the user for temperatures for ten consecutive days in Celsius and store them into an array. The entire array should then be displayed. Next each temperature in the array should be converted to Fahrenheit and stored into a 2nd array. This entire array should then be displayed. The formula for converting Celsius to Fahrenheit is °F = (°C × 1.8) + 32. Finally, the number of cool, warm and hot days should be counted...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT