|Hi, New here, and would be very thankful for any help someone can give me.
The code I am working for is a population estimator. It has 3 text boxes, the first is two enter the starting population, the second is to enter the daily increase in that population in a percentage, and the third is the number of days to multiply that by.
My first issue is with the second text box. I don't know how to enter the data as a percent. As of now it is only entering as a whole number, so I when I right in text box one the number 2, in box2 the number 30, and in three the number 10, I get the 302. Not 21.209 like it should be.
Secondly, it all displays in a listbox, and its supposed to loop for every day you enter. I've got the loop to loop by days, but it just runs the same calculation, I want it make every entry build off the last.
It should say
I've entered in the code below.
Thanks for any help!
private void calculateButton_Click(object sender, EventArgs e)
int count = 1;
if (int.TryParse(OrganismsTextbox.Text, out organisms))
if (int.TryParse(DailyTextbox.Text, out growth ))
if (int.TryParse(DaysTextbox.Text, out days))
population = organisms + growth * days;
resultsListbox.Items.Add("The population For day " + count + " is " + population.ToString("n1"));
count = count + 1;
while (count <= days);