Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class BosniaPopulation {
- public static void main (String [] args) {
- Scanner input = new Scanner (System.in);
- int currentYear;
- int minutes = 1440 * 365;
- int area;
- double currentPop;
- double newborn;
- double year;
- double death;
- double emigrants;
- int randomYear;
- System.out.println("Enter current year: ");
- currentYear = input.nextInt();
- System.out.println("Please enter the area size: ");
- area = input.nextInt();
- System.out.print ("Enter Current BiH Population: ");
- currentPop = input.nextLong(); //Current Bosnian population is 3,867,055
- System.out.print ("Enter number of minutes per every newborn: ");
- newborn = input.nextInt(); //Number of minutes per newborn is 19
- System.out.print ("Enter number of minutes per every death: ");
- death = input.nextInt(); //Number of minutes per death is 15
- System.out.println("Enter number of minutes per every emigrant: ");
- emigrants = input.nextInt(); //Number of minutes per emigrant is 25
- System.out.println();
- year = ((minutes / newborn) - (minutes / death) - (minutes / emigrants));
- System.out.println ("Change in population over the course of next 10 years:");
- System.out.println();
- System.out.println("2016: population - " + currentPop + " ppl; " + "density: " + (currentPop / area) + " ppl/sqkm;");
- System.out.println("2017: population - " + (currentPop + year) + " ppl; " + "density: " + ((currentPop + year) / area) + " ppl/sqkm;");
- System.out.println("2019: population - " + (currentPop + (year * 2)) + " ppl; " + "density: " + ((currentPop + (year * 2)) / area) + " ppl/sqkm;");
- System.out.println("2020: population - " + (currentPop + (year * 3)) + " ppl; " + "density: " + ((currentPop + (year * 3)) / area) + " ppl/sqkm;");
- System.out.println("2021: population - " + (currentPop + (year * 4)) + " ppl; " + "density: " + ((currentPop + (year * 4)) / area) + " ppl/sqkm;");
- System.out.println("2022: population - " + (currentPop + (year * 5)) + " ppl; " + "density: " + ((currentPop + (year * 5)) / area) + " ppl/sqkm;");
- System.out.println("2023: population - " + (currentPop + (year * 6)) + " ppl; " + "density: " + ((currentPop + (year * 6)) / area) + " ppl/sqkm;");
- System.out.println("2024: population - " + (currentPop + (year * 7)) + " ppl; " + "density: " + ((currentPop + (year * 7)) / area) + " ppl/sqkm;");
- System.out.println("2025: population - " + (currentPop + (year * 8)) + " ppl; " + "density: " + ((currentPop + (year * 8)) / area) + " ppl/sqkm;");
- System.out.println("2026: population - " + (currentPop + (year * 9)) + " ppl; " + "density: " + ((currentPop + (year * 9)) / area) + " ppl/sqkm;");
- System.out.println("2027: population - " + (currentPop + (year * 10)) + " ppl; " + "density: " + ((currentPop + (year * 10)) / area) + " ppl/sqkm;");
- System.out.println();
- System.out.println("If you want to check the number of population in some other year, please type it below: ");
- randomYear = input.nextInt();
- while(randomYear > 2152){
- System.out.println("By the year " + randomYear + " Bosnian population is 0.");
- System.out.println("Please try some other year: ");
- randomYear = input.nextInt();
- }
- System.out.println();
- while(randomYear < 2016){
- System.out.println("Unfortunately system does not have information going back past 2016");
- System.out.println("Please try some other year: ");
- randomYear = input.nextInt();
- System.out.println();
- }
- System.out.println();
- if (randomYear >2016 && randomYear <= 2152) {
- System.out.println(randomYear + ": population - " + ((((randomYear - currentYear) * (year)) + currentPop)) + " ppl; " + "density: " + ((((randomYear - currentYear) * (year)) + currentPop) / area) + " ppl/sqkm;");
- }
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement