Computer science I
”
1.6(Summation of a series) Write a program that displays the result of1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9.1.7(Approximate pi) pi can be computed using the following formula:pi = 4 * (1 – 1/3 + 1/5 – 1/7 + 1/9 – 1/11 + …)Write a program that displays the result of 4 * (1 – 1/3 + 1/5 – 1/7 + 1/9 – 1/11)and 4 * (1 – 1/3 + 1/5 – 1/7 + 1/9 – 1/11 + 1/13).Use 1.0 instead of 1 in your program.1.11(Population projection) The U.S. Census Bureau projects population based on thefollowing assumptions:■ One birth every 7 seconds■ One death every 13 seconds■ One new immigrant every 45 secondsWrite a program to display the population for each of the next five years. Assume thecurrent population is 312,032,486 and one year has 365 days. Hint: In Java, if twointegers perform division, the result is an integer. The fractional part is truncated. Forexample, 5 / 4 is 1 (not 1.25) and 10 / 4 is 2 (not 2.5). To get an accurate result withthe fractional part, one of the values involved in the division must be a number with adecimal point. For example, 5.0 / 4 is 1.25 and 10 / 4.0 is 2.5.
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
