1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sergiy2304 [10]
4 years ago
12

A bug collector collects bugs every day for 5 days. Write a program that keeps a running total of the number of bugs collected d

uring 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.

Computers and Technology
1 answer:
Brums [2.3K]4 years ago
7 0

Answer:

Complete code with step by step comments for explanation and output results are given below.

Python Code with Explanation:

# Initialize the counter total_bugs to store the running total of bugs  

total_bugs = 0

# Define number of days

days = 5

# Use a for loop to run for "days" number of times to take input from user

for i in range(days):

# i+1 makes sure the days start from 1 rather than 0

   print('Please enter the no. of bugs collected on day',i+1)

# Ask the user to input no. of bugs collected each day

   bugs = eval(input("Bugs collected: "))

# Keep adding new number of bugs  into running total of number of bugs

   total_bugs += bugs

# Print the total number of bugs collected in 5 days

print('The total number of bugs collected in 5 days: ', total_bugs)

Output:

Please enter the no. of bugs collected on day 1

Bugs collected: 10

Please enter the no. of bugs collected on day 1

Bugs collected: 20

Please enter the no. of bugs collected on day 1

Bugs collected: 15

Please enter the no. of bugs collected on day 1

Bugs collected: 10

Please enter the no. of bugs collected on day 1

Bugs collected: 30

The total number of bugs collected in 5 days: 85

You might be interested in
Los antivirus no son infalibles y en ocasiones pueden darnos:
Damm [24]

la respuesta es:

Falsos Positivos

6 0
3 years ago
Present a detailed data model for your project scenario. You can create your data model using Microsoft Visio 2010, which you wi
Troyanec [42]

Answer:

THE FARMERS PRICE CENTER

The farmer's price center is about helping farmers acquire farm inputs easily

and conveniently. Through relevant branches and supportive statt, the farmers

price center provides a fresh perspective on the day to day hardships that farmers

Tace. The tarmer's price center is run by a practicing tarnmer with tirst hand

information as he holds a bachelors degree in agriculture. His unique perspective

allows farmers to automatically connect with his point of view. The farmer's center

is equally informal as it is also a mentor or a friend. Besides selling farm inputs,

the center guides tarmers overcome their challenges.

The tarmer's price center addresses the tarming and tarming management

sector. The people who purchase from famers price center are either practicing

tarmers or want to start a venture in agriculture. They have a natural drive to create

agricultural products and seek out professional advice. The ideal customer for the

farmer's price center would be the new farmer or investor who wants to start an

agricultural venture or manage their firm better. The farmer's price center provides

a comprehensive resource that answers the questions farmers have while at the

same time giving thema step by step way to succeed. Mostly, farmers do not have

The farrmers price center will be getting 5,000 unique customers per month

and be ranked as a pace setter and a trusted mentor and be ranked as a leader in

agricultural products and advice site. To achieve these long term goals, the

Tarmer s price center needs to apply imbound marketing te chniques to get tound.

Part or this strategy will be to contract sales representatives to market the varlous

products to the retail shops across the countryside. These sales representatives are

to be paid a retainer and commission upon hitting their sales target. The (products

are transported by our fleet of trucks to the customer's premises. Payment shall be

made on cheque at the end of the month according to the number of products

delivered. Each sales representative shall prepare a report on their daily sales with

accordance to their specitic routes.

ne raners price center is all about neiping ramers tnve n tne cndotic

world of business filled with scrupulous products. The farmer's price center will

achieve upwards of 5,000 unique customers and S10,000 in revenue per month

within the next two years.

6 0
3 years ago
Develop an algorithm and write a C++ program that finds the number of occurrences of a specified character in the string; make s
nirvana33 [79]

Answer:

The algorithm is as follows:

1. Input sentence

2. Input character

3. Length = len(sentence)

4. count = 0

5. For i = 0 to Length-1

 5.1 If sentence[i] == character

    5.1.1 count++

6. Print count

7. Stop

The program in C++ is as follows:

#include <iostream>

#include <string.h>

using namespace std;

int main(){

char str[100];   char chr;

cin.getline(str, 100);

cin>>chr;

int count = 0;

for (int i=0;i<strlen(str);i++){

 if (str[i] == chr){

  count++;} }

cout << count;

return 0;}

Explanation:

I will provide explanation for the c++ program. The explanation can also be extended to the algorithm

This declares the string and the character

char str[100];   char chr;

This gets input for the string variable

cin.getline(str, 100);

This gets input for the character variable

cin>>chr;

This initializes count to 0

int count = 0;

This iterates through the characters of the string

for (int i=0;i<strlen(str);i++){

If the current character equals the search character, count is incremented by 1

 if (str[i] == chr){  count++;} }

This prints the count

cout << count;

8 0
3 years ago
What do you need to do before you can sort and filter data in a database?
Airida [17]
You need to first format the table becfor you can sort and filter data in a <span>database. ♥</span>
5 0
3 years ago
In the bussiness cycle which term best fits the labeled point on the graph
andrew11 [14]
In the business cycle, the term that best fits the labeled point on the graph of Production output vs Time is Contraction
8 0
2 years ago
Other questions:
  • EDI decreases ______
    15·1 answer
  • A student dissolves some solid sodium hydroxide in a beaker of water.
    5·2 answers
  • My programming lab 9.2 C++ Write a full class definition for a class named Counter, and containing the following members:_______
    6·1 answer
  • One foot equals 12 inches. Write a function named feet_to_inches that accepts a number of feet as an argument and returns the nu
    15·1 answer
  • While investigating an email issue, a support technician discovers no users can access their email accounts on the company’s ema
    13·1 answer
  • Carbon copy others who are..
    14·2 answers
  • A python package used in text analysis and natural language processing. True or False
    10·1 answer
  • Describe the steps which should be taken after a cyber-attack has taken place
    7·1 answer
  • ¿Cuántos motores tiene el Toyota Prius y que características poseen?
    15·1 answer
  • write pseudocode to represent the logic of a program that allows the user to enter two values. The program outputs the sum of an
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!