Answer to Question #54470 in AJAX | JavaScript | HTML | PHP for Toral

Question #54470
Write a program called population.js, that predicts the approximate size of a population of organisms. The program should use the following data:

Starting number of organisms: 2

Average daily increase: 30%

Number of days to multiply: 10

The program should display the following table of data:

Day Approiximate Population
1 2

2 2.6

3 3.38

4 4.394

5 5.7122

6 7.42586

7 9.653619

8 12.5497

9 16.31462

10 21.209
1
Expert's answer
2015-09-07T01:25:59-0400

population.js


document.write("Day Approiximate Population<br/>");

var temp = 2;
for (var i = 1; i <= 10; i++) {

document.write(i + " " + temp + "<br/>");

temp = (temp + (temp * 0.3));
}






Display.html

<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE> Javascript </TITLE>
</HEAD>
<BODY>
<h2>Population</h2>
<script src= "population.js"></script>

</BODY>
</HTML>

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS