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
witch option in a presentation program contains the formatting and placeholders for all the items that appear on a slide?
Nikitich [7]

SWITCH BETWEEN OPEN PRESENTATIONS. ..... Presentation software is a program designed for the production and display of .... image file format and version number. 1. .... Option. To Do This. Normal. Contains three panes: the outline pane, the slide pane, and the notes pane. .... appear on every slide in a presentation.

7 0
3 years ago
Read 2 more answers
Una pregunta cuales son los ataques de Sindel que por favor y me lo diga gracias
Len [333]
I do not know spanish please say in english
5 0
3 years ago
Can someone please help me answer this I can’t fail. tysm :)
vredina [299]

Answer:

  1. option d <em><u>b</u></em><em><u>e</u></em><em><u>c</u></em><em><u>a</u></em><em><u>u</u></em><em><u>s</u></em><em><u>e</u></em><em><u> </u></em><em><u>o</u></em><em><u>f</u></em><em><u> </u></em><em><u>y</u></em><em><u>o</u></em><em><u>u</u></em><em><u>. </u></em><em><u> </u></em><em><u> </u></em><em><u>b</u></em><em><u>l</u></em><em><u>a</u></em><em><u>a</u></em>

Explanation:

whu

5 0
3 years ago
A teacher uses the spreadsheet below to determine the average quiz score of each student. The teacher inserts this information i
Vinvika [58]

need help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

6 0
4 years ago
Read 2 more answers
Which device is connected to a port on a switch in order to receive network traffic?
inysia [295]

Answer:

"Passive IDS" is the appropriate answer.

Explanation:

  • A framework that is designed mostly for monitoring and analyzing internet traffic operations and alerting a user or administrator about possible bugs, as well as disruptions, is known to be passive IDS.
  • This IDS cannot carry out certain preventive as well as remedial processes as well as operations by itself.
6 0
3 years ago
Other questions:
  • What is binary coded decimal,EBCD and ASCII
    15·1 answer
  • What is the first step in the exchange between a web browser and a database?
    7·1 answer
  • Elaine had a problem with the computer printer she purchased. When she called the toll-free service number, she was told that sh
    7·1 answer
  • \Read the sentence.
    12·1 answer
  • What is information technology?
    12·1 answer
  • Advantage of realtime processing​
    14·1 answer
  • Hey guys i need help again on coding
    7·1 answer
  • Which are guidlines for using themes? Check all that apply
    13·1 answer
  • Which statement about technology before the invention of the printing press is true?
    8·1 answer
  • How much would you guys pay for a used ps4 with a black ops 3 disc?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!