Hey guys im new to java programming and have an assigment to write a code to calculate the current population of a organism.
My problem is i cannot figure out how use my updated population size, he counter just keeps on calulating the population size of the
given number . ( Hope this is clear run the program and my problem wil be obvious)
public class Population
public static void main(String args)
Scanner keyboard = new Scanner(System.in);
System.out.println("Please enter the number of organisms");
popsize = keyboard.nextDouble();
if(popsize < 2)
System.out.println( "Must be atleast 2 oranisms");
Scanner keyboard1 = new Scanner(System.in);
System.out.println("Please enter the population increase as a decimal");
averagepopincrease = keyboard1.nextDouble();
if(averagepopincrease <= 0)
System.out.println( "Average Population increase cannot be a negative number");
Scanner keyboard2 = new Scanner(System.in);
System.out.println("Please enter the amount of days you wish to calculate");
days = keyboard2.nextDouble();
for( days = 1; days <= 10; days++)
System.out.println((popsize * averagepopincrease) + popsize);
Re: Counter troubles
When posting code, please use the highlight tags to preserve formatting.
Why are you creating multiple scanners?
When do you take into account which day it is? When do you actually change the population? You're only using the initial values.