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
Julli [10]
4 years ago
10

Write a program that takes both the initial size of a green crud population (in pounds) and some number of days as input, and co

mputers from that information the size of the population (in pounds) after the specified number of days. If the input for crud population or days is a negative number, print an error message and exit.

Computers and Technology
1 answer:
Mekhanik [1.2K]4 years ago
5 0

Answer:

Complete c++ code with explanation and output results is given below

Explanation:

Fibonacci numbers are defined as F0 = 1, F1 = 1, and Fi + 2 = Fi + Fi + 1 where i = 0, 1, 2, 3,...  it means that each number is the sum of previous two numbers.

Fibonacci numbers has application in population growth rates such as green crud population.

Initial size of population is taken from the user and also the number of days for population growth.

If the user input negative population or days is a negative number then error message is shown and program terminates.

the growth constant is set to 10 days meaning that population will grow after every 10 days. rate is the number of times population will grow     then Fibonacci numbers are initialized and a for loop is used to compute the Fibonacci numbers that will determine the crud population growth.

Code:

#include <iostream>

using namespace std;

int main()

{

   int temp = 10;

   int days;

   int rate;

   float initial_size;

cout << "Please enter the initial weight (in pounds) of the population: "<<endl;

       cin >> initial_size;

         if(initial_size < 0)

       {

           cout<<"Error! Invalid input"<<endl;

           exit(0);

       }

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

       cin >> days;

       if(days < 0)

       {

           cout<<"Error! Invalid input"<<endl;

           exit(0);

       }

       double f0 = 0;

       double f1=initial_size;

       double f2=f0+f1;  

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

       {

           // Fibonacci sequence  

           f2= f1 + f0;

           f0 = f1;

           f1 = f2;

       }

cout <<"Green Crud Population has grown to: "<< f2 << " pounds.";

   return 0;

}

Output:

Please enter the initial weight (in pounds) of the population:

100

Enter the number of days

50

Green Crud Population has grown to: 800 pounds.

Please enter the initial weight (in pounds) of the population:

-50

Error! Invalid input

You might be interested in
According to Amdahl's Law, what is the speedup gain for an application that is 60% parallel and we run it on a machine with 4 pr
rodikova [14]

With four processing cores, we get a speedup of 1.82 times.

<h3>What is Amdahl's Law?</h3>

Amdahl's law exists as a formula that provides the theoretical speedup in latency of the implementation of a task at a fixed workload that can be expected of a system whose resources exist improved.

Amdahl's law exists that, in a program with parallel processing, a relatively few instructions that hold to be completed in sequence will have a limiting factor on program speedup such that adding more processors may not complete the program run faster.

Amdahl's law stands also known as Amdahl's argument. It is utilized to find the maximum expected progress to an overall system when only part of the system exists improved. It is often utilized in parallel computing to indicate the theoretical maximum speed up utilizing multiple processors.

Hence,  With four processing cores, we get a speedup of 1.82 times.

To learn more about Amdahl's Law refer to:

brainly.com/question/16857455

#SPJ4

6 0
2 years ago
The freemen's bureau was the U.S.' first ____ program.​
Ludmilka [50]

Answer:

welfare

Explanation:

The Freemen's bureau was the first Welfare program in the US that was put forward in the year 1865 just after the assassination of Abraham Lincoln. It was headed by Oliver O Howard. And it was brought for providing the food, clothing, medical care, and education to the recently freed white refugees and the freed slaves. And it was supposed to be a kind of welfare.  

6 0
4 years ago
Explain Organizational approach to System Analysis and Design
9966 [12]

Answer:

The major goal of systems analysis and design is to improve organizational systems. Often this process involves developing or acquiring application software and training employees to use it. Application software, also called a system, is designed to support a specific organizational function or process, such as inventory management, payroll, or market analysis. The goal of application software is to turn data into information. For example, software developed for the inventory department at a bookstore may keep track of the number of books in stock of the latest best seller. Software for the payroll department may keep track of the changing pay rates of employees. A variety of off-the-shelf application software can be purchased, including WordPerfect, Excel, and PowerPoint. However, off-the-shelf software may not fit the needs of a particular organization, and so the organization must develop its own product.

Explanation:

Information systems analysis and design is a method used by companies ranging from IBM to PepsiCo to Sony to create and maintain information systems that perform basic business functions such as keeping track of customer names and addresses, processing orders, and paying employees. The main goal of systems analysis and design is to improve organizational systems, typically through applying software that can help employees accomplish key business tasks more easily and efficiently. As a systems analyst, you will be at the center of developing this software. The analysis and design of information systems are based on:

Your understanding of the organization’s objectives, structure, and processes

Your knowledge of how to exploit information technology for advantage

7 0
3 years ago
ANSWER ASAP GIVING BRAINIEST FIVE STAR AND HEART!
vazorg [7]

Answer : A Formula is a method, statement, or procedure for achieving something, especially reconciling different aims or positions. A function is an activity or purpose natural to or intended for a person or thing. The difference between the two is a function is a piece of code that executes a predefined calculation, while a formula is something you create yourself.

4 0
3 years ago
Read 2 more answers
Eye injuries usually occur as a result of all of the following things, EXCEPT:
alexdok [17]

The correct answer is A I believe.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Using the flowchart below, what value when entered for Y will generate a mathematical error and prevent our flowchart from being
    14·1 answer
  • Programa en C
    9·1 answer
  • A(n) ________ is a variable that receives an argument that is passed into a function. global argument scope parameter
    15·1 answer
  • Jack is writing a paragraph for a school assignment. He proofreads his paper and notices that he used the word, "then" many time
    15·2 answers
  • Implement a recursive program that takes in a number and finds the square of that number through addition. For example if the nu
    5·1 answer
  • Why must a mobile application be easily customized and personalized?
    14·2 answers
  • Irene wants to connect your smart phone wirelessly to her laptop in order to transfer images. which two images could she reasona
    15·1 answer
  • Comment on the following 2 arrays. int *a1[8]; int *(a2[8]); a1 is pointer to an array; a2 is array of pointers a1 is pointer to
    11·1 answer
  • Plz help Complete the sentence.
    11·2 answers
  • Difference between software developer and software engineer.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!