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

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...
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 +...
(you can make it up) Over a seven-day period, write down every penny that you spend,...
(you can make it up) Over a seven-day period, write down every penny that you spend, and what you buying. Include in your analysis, the monthly expenses you identified earlier in the course. Examine your analysis. What patterns do you see? WHAT IS YOUR LATTE FACTOR? That is, what might you be able to sacrifice, in favor of plowing more money into your savings? Now that you have identified areas of savings, how might you be able to make the...
Chapter 8 Programming exercise 6 "Days of each month" Original Exercise: Design a program that displays...
Chapter 8 Programming exercise 6 "Days of each month" Original Exercise: Design a program that displays the number of days in each month. The program’s output should be similar to this: January has 31 days. February has 28 days. March has 31 days. April has 30 days. May has 31 days. June has 30 days. July has 31 days. August has 31 days. September has 30 days. October has 31 days. November has 30 days. December has 31 days. The...
Suppose you have 4 factors to investigate. You have resource to do 2 replicates of a 2^4 design. But you can only conduct 8 runs every day.
Suppose you have 4 factors to investigate. You have resource to do 2 replicates of a 2^4 design. But you can only conduct 8 runs every day. How would you set up the treatments for each day? What will be the degree of freedom for MSE in your ANOVA table?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT