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
Xelga [282]
3 years ago
6

Write a program that will predict the size of a population of organisms. The program // should ask the user for the starting num

ber of organisms, their average daily population // increase (as a percentage of the current population), and the number of days they will // multiply. A loop should display the size of the population for each day.
Computers and Technology
1 answer:
nordsb [41]3 years ago
7 0

Answer:

Following are the program in the C++ Programming Language:

#include <iostream>

using namespace std;

int main() {

 float starting, average;

 int num;

 std::cout <<"Enter starting number of the organisms: ";

 while(!(std::cin >> starting)|| starting < 2){

   std::cout<<"starting number must be greater than 2\n";

   std::cout <<"Enter starting number of the organisms: ";

   std::cin.clear();

   std::cin.ignore(123,'\n');

 }

 std::cout <<"Enter the average of daily population is increase %: ";

 while(!(std::cin >> average)|| average < 0){

   std::cout<<"Average must be greater than 0\n Enter average";

   std::cin.clear();

   std::cin.ignore(123,'\n');

 }

   average *= .01;

 std::cout <<"Enter the number of days: ";

 while(!(std::cin >> num)|| num < 1){

   std::cout<<"Number of days no be less than 1\n" <<"Enterthe number of days\n";

   std::cin.clear();

   std::cin.ignore(123,'\n');

 }

 for(int i=0; i<num; i++){

   std::cout<<"population size of day"<<(i+1);

   std::cout<<": "<<starting<<std::endl;

   starting +=(starting*average);

 }

 return 0;

}

<u>Output</u>:

Enter starting number of the organisms: 4

Enter the average of daily population is increase %: 5

Enter the number of days: 4

population size of day1: 4

population size of day2: 4.2

population size of day3: 4.41

population size of day4: 4.6305

Explanation:

Here, we define header file "<iostream>" and namespace "std".

  • Then, we define the main() inside it, we set two float data type variable i.e., "starting", "average" and set an integer data type variable i.e., "num".
  • Then, we print a message and after that, we set the while loop for get input from the user in variable "starting" and pass the condition inside loop we print message than clear cin and ignore 123 then, we again do this to get  input from user in variable "average".
  • Then, we set the for loop and pass the condition inside the loop print the size of the day then print the value of "starting" after that we multiply.
  • Finally, we return 0 and close the main function.
You might be interested in
Which server tier is considered to be the most robust and less prone to failure?
Ne4ueva [31]
Tier 4 data center considered as most robust and less prone to failures. Tier 4 is designed to host mission critical servers and computer systems, with fully redundant subsystems (cooling, power, network links, storage etc) and compartmentalized security zones controlled by biometric access controls methods.
6 0
3 years ago
Read 2 more answers
Of the following scenarios, which one is best suited to a non-linear presentation?
lions [1.4K]

Answer: B. A brainstorm session on new titles for publication series.

Explanation: I think this is the answer if it is not and it is wrong I am very sorry.

8 0
3 years ago
Read 2 more answers
Which one is better AMD Ryzen 5 Or Nvidia Gtx 2080 ti
Oliga [24]

Answer:

The NVIDIA GTX 2030 Ti

Explanation:

The AMD Ryzen 5 is good for a starting gaming PC, but if you are looking for a gaming PC that could run a lot more games, use the NVIDIA GTX 2080 Ti.

8 0
3 years ago
Why do some people argue that tech companies like Apple should do more to address the smartphone addiction problem?
Neko [114]

Answer:

Cause It Will Help Make A Fix For The Issue

Explanation:

Does This Help?

5 0
3 years ago
How is a high-level programming language interpreted?
balu736 [363]

Answer:

Once a program is compiled, the chore of language translation is over with and therefore executing the program only requires execution time, not additional translation time. To execute an interpreted program, every instruction is translated first and then executed; this must be done every time the program is run.

Explanation:

8 0
3 years ago
Other questions:
  • PYTHON CODE ONLY:
    7·1 answer
  • In a series circuit, electrons only flow along one path. Given this information, which of the following is an advantage of serie
    15·2 answers
  • A hierarchical addressing scheme is used
    15·1 answer
  • Mike's boss told him he needs to be more efficient. Select each suggestion that will help him become more efficient at creating
    9·1 answer
  • MULTIPLE CHOICE!!!
    5·2 answers
  • What are the first steps in creating a business document
    6·2 answers
  • Telecommunications and software development are examples of information technology careers.
    5·1 answer
  • Hurry i need help What would provide structured content that would indicate what the code is describing ?
    12·1 answer
  • What program command saves a copy of a file under a different name
    14·1 answer
  • Kyle has a notebook for each of his 5 classes. He puts 6 stickers on each notebook. There are 10 stickers on each sheet. How man
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!