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
vfiekz [6]
3 years ago
8

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

of organisms, their average daily population increase (as a percentage, expressed as a fraction in decimal form: for example 0.052 would mean a 5.2% increase each day), and the number of days they will multiply. A loop should display the size of the population for each day.
Input Validation.Do not accept a number less than 2 for the starting size of the population. If the user fails to satisfy this print a line with this message "The starting number of organisms must be at least 2.", display the prompt again and try to read the value. Similarly, do not accept a negative number for average daily population increase, using the message "The average daily population increase must be a positive value." and retrying. Finally, do not accept a number less than 1 for the number of days they will multiply and use the message "The number of days must be at least 1."
Computers and Technology
1 answer:
sineoko [7]3 years ago
6 0

Answer:

// using c++ language

#include "stdafx.h";

#include <iostream>

#include<cmath>

using namespace std;

//start

int main()

{

 //Declaration of variables in the program

 double start_organisms;

 double daily_increase;

 int days;

 double updated_organisms;

 //The user enters the number of organisms as desired

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

 cin >> start_organisms;

 //Validating input data

 while (start_organisms < 2)

 {

     cout << "The starting number of organisms must be at least 2.\n";

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

     cin >> start_organisms;

 }

 //The user enters daily input, here's where we apply the 5.2% given in question

 cout << "Enter the daily population increase: ";

 cin>> daily_increase;

 //Validating the increase

 while (daily_increase < 0)

 {

     cout << "The average daily population increase must be a positive value.\n ";

     cout << "Enter the daily population increase: ";

     cin >> daily_increase;

 }

 //The user enters number of days

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

 cin >> days;

 //Validating the number of days

 while (days<1)

 {

     cout << "The number of days must be at least 1.\n";

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

     cin >> days;

 }

 

 //Final calculation and display of results based on formulas

 for (int i = 0; i < days; i++)

 {

     updated_organisms = start_organisms + (daily_increase*start_organisms);

     cout << "On day " << i + 1 << " the population size was " << round(updated_organisms)<<"."<<"\n";

     

     start_organisms = updated_organisms;

 }

 system("pause");

  return 0;

//end

}

Explanation:

You might be interested in
Kayla wants to know whether she should set her network up as a WAN or a LAN. What are the three questions you would ask her, and
Ann [662]
Due to it's typically massive size, WAN's are almost always slower then a LAN. The further the distance, the slower the network. One of the big disadvantages to having a WAN is the cost it can incur. Having a private WAN can be expensive.
3 0
2 years ago
Different algorithms can be made to complete the same task in different ways.
musickatia [10]

Answer:

True hope this helps you and everyone!

7 0
2 years ago
Read 2 more answers
You want to install an rodc in your windows server 2003 forest, which currently has all windows server 2003 domain controllers.
devlian [24]
Make sure the functional level of the forest functional level is Windows Server 2003 or higher. 
Install at least one Windows 2008 Server as a Writable Domain Controller
Run adprep /rodcprep<span> </span>
8 0
2 years ago
WHY IS BRAINLY NOTIFICATIONS LIKE THIS?????
nikdorinn [45]

Answer:

probly the wifi connection

Explanation:

4 0
2 years ago
Read 2 more answers
What are Three types of informational references
Irina-Kira [14]

Answer:

There are many types of information al references such as Encyclopedias, dictionaries, thesaurus Almanacs, atlases, thesauruses, Atlases, almanacs, and encyclopedias.

Explanation:

There are also informational websites. The way to find this is to look at the website url to see if it ends in .gov, .edu, and .org . But make sure you cite your source so you don't plagiarize.

If you don't have any questions feel free to ask in the comments.

3 0
3 years ago
Read 2 more answers
Other questions:
  • If you use a surrogate key, you must ensure that the candidate key of the entity in question performs properly through the use o
    5·1 answer
  • One of the original forms of viruses, is usually stored on some form of removable media. When the removable media is connected t
    9·1 answer
  • A(n) ____________________ or cryptosystem is an encryption method or process encompassing the algorithm, key(s) or cryptovariabl
    11·1 answer
  • How long does it take to be placed in a class on flvs?
    14·1 answer
  • When one user could perform a query to determine which recordings had a track length of four minutes or more, and another user c
    9·1 answer
  • Calculate the performance of a processor taking into account stalls due to data cache and instruction cache misses. The data cac
    11·1 answer
  • Using a single formatting _______ helps to make reading researched information easier; it lets the reader know what to expect.
    7·1 answer
  • You are the leader of a team at work. What type of leader would you like to be – one that gets involved and works with the team
    15·2 answers
  • A local bank has an in-house application which handles sensitive financial data in a private subnet. After the data is processed
    15·1 answer
  • A(n) ____ describes the structure, content, and access controls of a physical data store or database.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!