Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PopulationGrowth {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int initialNum, growthPeriod, hours, prediction;
- double growthRate;
- System.out.print ("Enter initial number of organisms: ");
- initialNum = Integer.parseInt (in.nextLine());
- System.out.print ("Enter rate of growth: ");
- growthRate = Double.parseDouble (in.nextLine());
- System.out.println ("Enter number of hours growth period: ");
- growthPeriod = Integer.parseInt (in.nextLine());
- System.out.println ("Enter number of hours applied: ");
- hours = Integer.parseInt (in.nextLine());
- prediction = (int) (initialNum * growthRate * hours / growthPeriod);
- System.out.println("Prediction: "+prediction);
- } // main()
- } // class PopulationGrowth
Advertisement
Add Comment
Please, Sign In to add comment