Student :(
2009-12-11 12:47:47 UTC
The first one :
The Fibonacci numbers Fn are defined as follows:
F0 is 1, F1 is 1, and Fi+2 = Fi + Fi+1 i = 0, 1, 2, ….
In other words, each number is the sum of the previous two numbers. The first few Fibonacci numbers are 1, 1, 2, 3, 5, and 8. One place where these numbers occur is as certain population growth rates. If a population has no deaths, then the series shows the size of the population after each time period. It takes an organism two time periods to mature to reproducing age, and then the organism reproduces once every time period. The formula applies most straightforwardly to asexual reproduction at a rate of one offspring per time period. In any event, the green crud population grows at this rate and has a time period of five days. Hence, if a green crud population starts out as 10 pounds of crud, then in five days there is still 10 pounds of crud; in ten days there is 20 pounds of crud, in fifteen days 30 pounds, in twenty days 50 pounds, and so forth.
Write a program that takes both the initial size of a green crud population (in pounds) and a number of days as input, and outputs the number of pounds of green crud after that many days. Assume that the population size is the same for four days and then increases every fifth day. Your program should allow the user to repeat this calculation as often as desired.
For example, a possible sample dialog of your program might be:
Enter the initial size of a green crud population (in pounds): 10
Enter the number of days: 15
The size of the population after 15 days is 30 pounds.
Do you want to repeat the calculation with different values? (y/n): y
Enter the initial size of a green crud population (in pounds): 10
Enter the number of days: 24
The size of the population after 24 days is 50 pounds.
Do you want to repeat the calculation with different values? (y/n): n
Good bye!
...
The SECOND one :
The value can be approximated by the sum:
Write a program that takes a value x as input and outputs this sum for n taken to be each of the values 1 to 10, 50, and 100. Your program should repeat the calculation for new values of x until the user says she or he is through. The expression n ! is called the factorial of n and is defined as
Use variables of type double to store the factorials (or arrange your calculation to avoid any direct calculation of factorials); otherwise, you are likely to produce integer overflow, that is, integers larger than Java allows.
For example, a possible sample dialog of your program could be:
Enter the value of x: 1
for n = 1, e^x = 2
for n = 2, e^x = 2.5
for n = 3, e^x = 2.666667
for n = 4, e^x = 2.7083333
for n = 5, e^x = 2.716666667
for n = 6, e^x = 2.718055556
for n = 7, e^x = 2.718253968
for n = 8, e^x = 2.71827877
for n = 9, e^x = 2.718281526
for n = 10, e^x = 2.718281801
for n = 50, e^x = 2.718281828
for n = 100, e^x = 2.718281828
Do you want to try another value of x? (y/n): y
Enter the value of x: 2.5
for n = 1, e^x = 3.5
for n = 2, e^x = 6.625
for n = 3, e^x = 9.229167
for n = 4, e^x = 10.856771
for n = 5, e^x = 11.67057292
for n = 6, e^x = 12.00965712
for n = 7, e^x = 12.13075862
for n = 8, e^x = 12.16860284
for n = 9, e^x = 12.17911512
for n = 10, e^x = 12.18174319
for n = 50, e^x = 12.18249396
for n = 100, e^x = 12.18249396
Do you want to try another value of x? (y/n): n
Good bye!
..
PLEASE Guys Need it as soon as possible .. I have to submit it Saturday 12/30 maybe I can submit it later but I really want it
Thanks Guys I really appreciate your help and I always used to use YAHOO answers to just see the answers byt NOW I have Question and need help :)