Advertisement
harisjasar

Untitled

Mar 12th, 2017
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. package homework_final;
  2.  
  3. public class PopulationAndDensity {
  4. public static void main (String[] args){
  5. int birth = 19; // 1 newborn every 19 mins
  6. int death = 15; // 1 death every 15 mins
  7. int day = 1440; // number of minutes in a day
  8. int emigrant = 25; // 1 emigrant every 25 mins
  9. int mins_year = day * 365; // minutes in a year
  10. int currentPopulation = 3867055;
  11. int area = 51197; // the area of the Bosnia and Herzegovina
  12.  
  13. int ChangeOverYear = (mins_year / birth) - (mins_year / death) - (mins_year / emigrant);
  14.  
  15. System.out.println("2016: population - " + currentPopulation + " ppl;" + " density - " + (currentPopulation / area) + " ppl/sqkm");
  16. System.out.println("2017: population - " + (currentPopulation + (ChangeOverYear*1) + " ppl;" + " density - " + ((currentPopulation + (ChangeOverYear*1)) / area) + " ppl/sqkm"));
  17. System.out.println("2018: population - " + (currentPopulation + (ChangeOverYear*2) + " ppl;" + " density - " + ((currentPopulation + (ChangeOverYear*2)) / area) + " ppl/sqkm"));
  18. System.out.println("2019: population - " + (currentPopulation + (ChangeOverYear*3) + " ppl;" + " density - " + ((currentPopulation + (ChangeOverYear*3)) / area) + " ppl/sqkm"));
  19. System.out.println("2020: population - " + (currentPopulation + (ChangeOverYear*4) + " ppl;" + " density - " + ((currentPopulation + (ChangeOverYear*4)) / area) + " ppl/sqkm"));
  20. System.out.println("2021: population - " + (currentPopulation + (ChangeOverYear*5) + " ppl;" + " density - " + ((currentPopulation + (ChangeOverYear*5)) / area) + " ppl/sqkm"));
  21. System.out.println("2022: population - " + (currentPopulation + (ChangeOverYear*6) + " ppl;" + " density - " + ((currentPopulation + (ChangeOverYear*6)) / area) + " ppl/sqkm"));
  22. System.out.println("2023: population - " + (currentPopulation + (ChangeOverYear*7) + " ppl;" + " density - " + ((currentPopulation + (ChangeOverYear*7)) / area) + " ppl/sqkm"));
  23. System.out.println("2024: population - " + (currentPopulation + (ChangeOverYear*8) + " ppl;" + " density - " + ((currentPopulation + (ChangeOverYear*8)) / area) + " ppl/sqkm"));
  24. System.out.println("2025: population - " + (currentPopulation + (ChangeOverYear*9) + " ppl;" + " density - " + ((currentPopulation + (ChangeOverYear*9)) / area) + " ppl/sqkm"));
  25. System.out.println("2025: population - " + (currentPopulation + (ChangeOverYear*10) + " ppl;" + " density - " + ((currentPopulation + (ChangeOverYear*10)) / area) + " ppl/sqkm"));
  26. }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement