Question

Assignment 4 2018 Simple Functions and Looping Task or estimated I. The progam will ask the rr The functionwl Assignment 4 20


media%2Fe8c%2Fe8ca4a39-535d-46c8-878e-b3
5. Sample results: starting with 100 Streptococcus lactis for 90 minutes 90min 26min-3.5generations (will use 3 for number of
Assignment 4 2018 Simple Functions and Looping Task or estimated I. The progam will ask the rr The functionwl Assignment 4 2018 Simple Functions and Looping Here is one approach you couild take Upload

5. Sample results: starting with 100 Streptococcus lactis for 90 minutes 90min 26min-3.5generations (will use 3 for number of generations) . After the first generation b 100 x21 200 .After the second generation b 100 x 22 400 After the third generation b 100 x 23 -800 Remember that you don't have to build the whole program before testing it - in fact you should not. Here is one approach you could take: Build the shell of the function-test by making a call to it . o Add a loop that just loops the expected number of times (put a print statement inside it so you can see if it is working) Add the math-test it o .Now add the code to have the user input the required data Your program must be neat, well formatted, and readable (see the style guide on iLearn). Remember you can lose up to 30% for poor style. Don't forget comments that identify the programmer, the program, and the date the program was written.
1 0
Add a comment Improve this question Transcribed image text
Answer #1

NOTE

#######

As the programming language is not specified,it is assumed that language is python as int() function is to be used .

####################### PGM START ##############################

#function to calculate bacterial growth
def grow_bacteria(gen_t,start_c,reprd_t):
    #finding number of generations
    n=int(reprd_t/gen_t)
    sum=0
    #for each generation calculate bacterial count and print
    for i in range(n):
        sum=start_c*pow(2,(i+1))
        print("After generation-"+str((i+1))+", b = "+str(sum))
    #return the final count
    return sum

#main method
if __name__=="__main__":
  
    #requesitng generation time
    generation_time=int(input("Enter generation time: "))
    #requesting starting count
    starting_count=int(input("Enter starting count of bacteria: "))
    #requesting reproduction period
    reprod_time=int(input("Enter total time to reproduce: "))
    #finding the bacterial count in each generation
    result=grow_bacteria(generation_time,starting_count,reprod_time)
    #prinitng final bacterial count
    print("\n\tTOTAL BACTERIA: "+str(result))

####################### PGM END #################################

OUTPUT
########

Enter generation time: 26 Enter starting count of bacteria: 100 Enter total time to reproduce: 90 After generation-1, b-200 A

Add a comment
Know the answer?
Add Answer to:
Assignment 4 2018 Simple Functions and Looping Task or estimated I. The progam will ask the rr Th...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • SOLVE USING C!!! Project objective: Conditional statements, loops, reading from file, user defined functions. **Submit source...

    SOLVE USING C!!! Project objective: Conditional statements, loops, reading from file, user defined functions. **Submit source code (LargeProg1.c) through Canvas One source code file(unformatted text) will be submitted Here is INCOMPLETE code to get started: LargeProg1.c The file name must match the assignment The code should be tested and run on a Microsoft compiler before it is uploaded onto Canvas The code must be submitted on time in order to receive credit (11:59PM on the due date) Late submissions will...

  • I need help with this assignment in C++, please! *** The instructions and programming style detai...

    I need help with this assignment in C++, please! *** The instructions and programming style details are crucial for this assignment! Goal: Your assignment is to write a C+ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, I'O manipulators, and the string class. File format: Here is an example of a file...

  • Assignment 5 will be way different. It will be more like what you will receive in...

    Assignment 5 will be way different. It will be more like what you will receive in a programming shop. By that I mean that some things are built for you and others you will need to create or finish. P.S. part of your grade will include: Did you add in the required files? Did you rename your project? does your linear searches work? Did you put your code in the correct modules? did you change modules that you weren't supposed...

  • Assignment 4 Real Deal: Crier On Us Some word games, like Scrabble, require rearranging a combination of letters to make...

    Assignment 4 Real Deal: Crier On Us Some word games, like Scrabble, require rearranging a combination of letters to make a word. This type of arrangement is generally referred to as an anagram, it's known as a permutation in mathematics. This assignment will give you some experience thinking about and writing recursive functions. Write a C++ program that searches for ``anagrams'' in a dictionary. An anagram is a word obtained by scrambling the letters of some string. For example, the...

  • C++ For this assignment you will be building on the Original Fraction class you began last...

    C++ For this assignment you will be building on the Original Fraction class you began last week. You'll be making four major changes to the class. [15 points] Delete your set() function. Add two constructors, a default constructor that assigns the value 0 to the Fraction, and a constructor that takes two parameters. The first parameter will represent the initial numerator of the Fraction, and the second parameter will represent the initial denominator of the Fraction. Since Fractions cannot have...

  • The homework assignment is to write a fee invoice using C. It must follow the guidelines posted i...

    The homework assignment is to write a fee invoice using C. It must follow the guidelines posted in the question and run as the sample run given. Here is the question and sample run below Please read the sample runs carefully as this is quite different from the previous projects. In this project, the student can take as many courses as permitted. The list of courses to take are listed below. This time there is no restriction on the total...

  • C programming is the main one and pick another code of choice!!! Background This assignment is...

    C programming is the main one and pick another code of choice!!! Background This assignment is based on one of the Big Ideas in this course, namely that reading C source code is a real aid in learning how to write C code. To that end, in this project, you write a program that scans C source from the 'Net and calculates some simple statistics. We're learning lots of concepts, and by running the program you write here on several...

  • C++ assignment help! The instructions are below, i included the main driver, i just need help...

    C++ assignment help! The instructions are below, i included the main driver, i just need help with calling the functions in the main function This assignment will access your skills using C++ strings and dynamic arrays. After completing this assignment you will be able to do the following: (1) allocate memory dynamically, (2) implement a default constructor, (3) insert and remove an item from an unsorted dynamic array of strings, (4) use the string class member functions, (5) implement a...

  • I really need help with this python programming assignment Program Requirements For part 2, i need...

    I really need help with this python programming assignment Program Requirements For part 2, i need the following functions • get floats(): It take a single integer argument and returns a list of floats. where it was something like this def get_floats(n):   lst = []   for i in range(1,n+1):     val = float(input('Enter float '+str(i)+': '))     lst.append(val)   return lst • summer(): This non-void function takes a single list argument, and returns the sum of the list. However, it does not use...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT