The nth Fibonacci number F, is defined as follows: and Fo=1, F1=1, FnFn-1 + Fn-2 for n > 1 In other words, each number is the sum of the two previous numbers in the sequence. Thus, the first several Fibonacci numbers are 1, 1, 2, 3, 5, and 8. Interestingly, certain population growth rates are characterized by the Fibonacci numbers. If a population has no deaths, then the series gives the size of the population after each time period. Assume that a population of green crud grows at a rate described by the Fibonacci numbers and has a time period of 5 days. Hence, if a green crud population starts out as 10 pounds of crud, then after 5 days, there is still 10 pounds of crud; in 10 days, there is 20 pounds of crud; in 15 days, 30 pounds of crud; in 20 days, 50 pounds of crud, and so on. Write a program that takes both the initial size of a green crud population (in pounds) and some number of days as input from the keyboard, and computes from that information the size of the population (in pounds) after the specified number of days. Assume that the population size is the same for four days and then increases every fifth day. The program must allow the user to repeat this calculation as long as desired. Please note that zero is a valid number of days for the crud to grow in which case it would remain at its initial value. Your output should look something like: C\Windows\system32\ende lease enter the initial size of the green crud: no value is unrecognized or is negative. the initial size of the green crud: -3 'm sorry that value is unrecognized or is negative. lease enter the initial size of the green crud: 10 m sorry that lease enter Please enter the population of 30 pounds of crud growing for 20 days. With an initial on would be 50 Hould you like to continue? am pounds (y/n)why? ans sorry, that swer is not recognized Bould you like to continue? (y/p)y, enter the initial Please enter the ize of the green crud: 10 initial population of 10 pounds of crud growing for 0 days. the final population would be 10 pounds Hould you like to continue? (y/n)n Press any key to continue... 100

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 

?! 

 

The nth Fibonacci number F, is defined as follows:
and
Fo= 1, F1 = 1,
Fn=Fn-1 + Fn-2 for n > 1
In other words, each number is the sum of the two previous numbers in the sequence. Thus, the
first several Fibonacci numbers are 1, 1, 2, 3, 5, and 8. Interestingly, certain population growth
rates are characterized by the Fibonacci numbers. If a population has no deaths, then the series
gives the size of the population after each time period.
Assume that a population of green crud grows at a rate described by the Fibonacci numbers and
has a time period of 5 days. Hence, if a green crud population starts out as 10 pounds of crud,
then after 5 days, there is still 10 pounds of crud; in 10 days, there is 20 pounds of crud; in 15
days, 30 pounds of crud; in 20 days, 50 pounds of crud, and so on.
Write a program that takes both the initial size of a green crud population (in pounds) and some
number of days as input from the keyboard, and computes from that information the size of the
population (in pounds) after the specified number of days. Assume that the population size is the
same for four days and then increases every fifth day. The program must allow the user to repeat
this calculation as long as desired. Please note that zero is a valid number of days for the crud to
grow in which case it would remain at its initial value.
Your output should look something like:
C:\Windows\system32cmd.exe
Please enter the initial size of the green crud: no
'm sorry, that, value, is unrecognized or is negative.
Please enter the initial size of the green crud: -3
'm sorry, that, value is unrecognized or is negative.
Please enter the initial size of the green crud: 10
Please enter the number of days: 20
With an initial population of 10 pounds of crud growing for 20 days,
the final population would 50 pounds
continue? (y/n)why?
am that is
you
to
Bould you like to continue? ognized
15
initial size of the green crud: 10
Please enter the number of days
With an initial population of 10 pounds of crud growing for 0 days,
the final population would be 10 pounds
Hould you like to continue? (y/n)n
Press any key to continue...
1-0
A
Transcribed Image Text:The nth Fibonacci number F, is defined as follows: and Fo= 1, F1 = 1, Fn=Fn-1 + Fn-2 for n > 1 In other words, each number is the sum of the two previous numbers in the sequence. Thus, the first several Fibonacci numbers are 1, 1, 2, 3, 5, and 8. Interestingly, certain population growth rates are characterized by the Fibonacci numbers. If a population has no deaths, then the series gives the size of the population after each time period. Assume that a population of green crud grows at a rate described by the Fibonacci numbers and has a time period of 5 days. Hence, if a green crud population starts out as 10 pounds of crud, then after 5 days, there is still 10 pounds of crud; in 10 days, there is 20 pounds of crud; in 15 days, 30 pounds of crud; in 20 days, 50 pounds of crud, and so on. Write a program that takes both the initial size of a green crud population (in pounds) and some number of days as input from the keyboard, and computes from that information the size of the population (in pounds) after the specified number of days. Assume that the population size is the same for four days and then increases every fifth day. The program must allow the user to repeat this calculation as long as desired. Please note that zero is a valid number of days for the crud to grow in which case it would remain at its initial value. Your output should look something like: C:\Windows\system32cmd.exe Please enter the initial size of the green crud: no 'm sorry, that, value, is unrecognized or is negative. Please enter the initial size of the green crud: -3 'm sorry, that, value is unrecognized or is negative. Please enter the initial size of the green crud: 10 Please enter the number of days: 20 With an initial population of 10 pounds of crud growing for 20 days, the final population would 50 pounds continue? (y/n)why? am that is you to Bould you like to continue? ognized 15 initial size of the green crud: 10 Please enter the number of days With an initial population of 10 pounds of crud growing for 0 days, the final population would be 10 pounds Hould you like to continue? (y/n)n Press any key to continue... 1-0 A
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education