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]
3 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]3 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
Carlos is using the software development life cycle to create a new app. He has finished coding and is ready to see the output i
Nitella [24]

Answer:

Testing

Explanation:

From the question, we understand that Carlos just finished the coding of the app.

In software development life cycle, the coding phase is where Carlos is expected to make use of his choice of programming language to design the app;

This stage is an integral part of the implementation process and according to the question, the coding has been completed;

The next phase or stage after the implementation phase is testing.

Hence, Carlos is getting ready to test the app.

4 0
2 years ago
Read 2 more answers
Create a class called Fraction. Provide a constructor that takes 2 integers. Provide methods for:
tekilochka [14]

Answer:

Explanation;

else

System.out.println("f1 and f2 are not equal");

switch (input.charAt(0)

{

case '+':

f3 = f1.add(f2);

System.out.println("f1+f2=" + f3);

break;

case '-':

f3 = f1.subtract(f2);

System.out.println("f1-f2=" + f3);

break;

case '*':

f3 = f1.multiply(f2);

System.out.println("f1*f2="+f3);

break;

case '/':

f3 = f1.divide(f2);

System.out.println("f1/f2="+f3);

break;

default:

System.out.println("Illegal command: " + input );

break;

}

}// end of while loop

} // end of main

}

 

Note ; this is the last part of the programme check the attachment from 1-5  this is the 6th .

8 0
2 years ago
How do networks help protect data? -by preventing access by more than one person at a time -by restricting access to department
Whitepunk [10]

Answer:

because they have to rest

3 0
2 years ago
Read 2 more answers
In order to send a photo in a text message from your cell phone to your cousin's cell phone who lives in New Zealand, is it nece
Nata [24]

Answer: No, because all you need is WiFi for both devices and a messaging app to do it for free like iMessage.

Explanation: Please correct me if I am wrong! :)

8 0
3 years ago
5)What are the differences in the function calls between the four member functions of the Shape class below?void Shape::member(S
Stells [14]

Answer:

void Shape :: member ( Shape s1, Shape s2 ) ; // pass by value

void Shape :: member ( Shape *s1, Shape *s2 ) ; // pass by pointer

void Shape :: member ( Shape& s1, Shape& s2 ) const ; // pass by reference

void Shape :: member ( const Shape& s1, const Shape& s2 ) ; // pass by const reference

void Shape :: member ( const Shape& s1, const Shape& s2 ) const ; // plus the function is const

Explanation:

void Shape :: member ( Shape s1, Shape s2 ) ; // pass by value

The s1 and s2 objects are passed by value as there is no * or & sign with them. If any change is made to s1 or s2 object, there will not be any change to the original object.

void Shape :: member ( Shape *s1, Shape *s2 ) ; // pass by pointer

The s1 and s2 objects are passed by pointer as there is a * sign and not & sign with them. If any change is made to s1 or s2 object, there will be a change to the original object.

void Shape :: member ( Shape& s1, Shape& s2 ) const ; // pass by reference

The s1 and s2 objects are passed by reference  as there is a & sign and not * sign with them. If any change is made to s1 or s2 object.

void Shape :: member ( const Shape& s1, const Shape& s2 ) ; // pass by const reference

The s1 and s2 objects are passed by reference  as there is a & sign and not * sign with them. The major change is the usage of const keyword here. Const keyword restricts us so we cannot make any change to s1 or s2 object.

void Shape :: member ( const Shape& s1, const Shape& s2 ) const ; // plus the function is const

The s1 and s2 objects are passed by reference  as there is a & sign and not * sign with them. const keyword restricts us so we cannot make any change to s1 or s2 object as well as the Shape function itself.

5 0
3 years ago
Other questions:
  • A form of Internet identity theft involving phony e-mail messages asking customers to update their credit card numbers, account
    7·1 answer
  • Your desktop computer monitor is not displaying a picture. What would you do to troubleshoot the problem?
    7·2 answers
  • A tornado may be approaching if you observe which of the following?
    15·1 answer
  • This type of peripheral is used to interact with, or send data to, the computer.
    12·2 answers
  • A keyboard is a/an _____. interconnector port packet NAS
    7·1 answer
  • When creating a chart or graph, which should be completed first?
    9·2 answers
  • John travels a lot and he needs to access his documents and services on the go. Which of these technologies allows his to access
    5·1 answer
  • When all the system testing and bugs correction has done, the software product will be delivered to the user for __________.
    15·1 answer
  • Which of these is not an example of a transition
    6·1 answer
  • Each of the flowchart segments in Figure 3-24 is unstructured. Redraw each segment so that it does the same processes under the
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!