Write a program that predicts the appropriate size of a population of organisms.
ID: 3795951 • Letter: W
Question
Write a program that predicts the appropriate size of a population of organisms. The application should use text boxes to allow the user to enter the starting number of organisms, the average daily population increase(as a percentage) and the number of days the organisms will be left to multiply. For example, assume the user enters the following values.
Starting number of organisms : 2
Average daily increase: 30%
Number of days to multiply: 10
The program should display the following data:
Day Approximate 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 to 10 are serial numbers and the digits to the right falls under pupolation classification
Explanation / Answer
Public Class Form1
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
'closes the form.
Me.Close()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
'clears the list box.
Output.Items.Clear()
'clears the combo boxes
cboOrganisms.SelectedIndex = -1
cboOrganisms.Text = String.Empty
cboDays.SelectedIndex = -1
cboDays.Text = String.Empty
'clears the text box
intAverage.Clear()
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
'variables declared.
Dim intAverage As Integer
Dim intCount As Integer
Dim intTotal As Integer
'calculates the population
For intCount = 1 To cboDays.Text
intTotal = cboOrganisms.Text * intAverage
Output.Items.Add(intTotal)
Next
End Sub
End Class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.