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