Intro to Java Chapter 01 Exercise 11 - Population Project

preview_player
Показать описание

Book: Introduction to Java Programming and Data Structures, Comprehensive Version, 11th Edition
Authors: Daniel Liange
Chapter: 01 Introduction to Computers, Programs, and Java
Programming Exercise: 11 - Population Project
Programming Language: Java
IDE: Intellij
Theme: Darkest Dark
Recording Software: CyberLink Screen Recorder

Feel free to leave comments and suggestions on how to make these videos better.
Рекомендации по теме
Комментарии
Автор

Here's a similar table declaring variables so you can update it easier
int Population ;
Population = 312032486;
//My equations for calculating births in a year
long births ;
births = ((60 * 60 *24 *365) / 7) ;
// Calculation for deaths in a year
long deaths ;
deaths = ((60 * 60 *24 *365) / 13 ) ;
//Calculation for immigrants per year
long immigrants ;
immigrants = ((60 * 60 *24 *365) / 45 ) ;
//Calculation for rate of change
long rateofchange ;
rateofchange = births - deaths + immigrants ;
//Output for births in a year
System.out.println("Number of births in a year = " + births ) ;
//Output for deaths in a year
System.out.println("Number of deaths in a year = " + deaths);
//Output for immigrants per year
System.out.println("Number of immigrants per year = " + immigrants );
//Table with population at year 0 through year 5
+
"\n0\t\t\t" + Population +
"\n1\t\t\t" + (Population + rateofchange) +
"\n2\t\t\t" + (Population + (rateofchange * 2)) +
"\n3\t\t\t" + (Population + (rateofchange * 3)) +
"\n4\t\t\t" +(Population + (rateofchange * 4)) +
"\n5\t\t\t" + (Population + (rateofchange * 5))) ;

davidbhyss
Автор

I hope your break down all the videos like this, as I think it’s more important to learn to solve the problem first before you write code! Because the syntax part is easy but the problem solving and reasoning needs to be explained just like you did here. Thanks man!!

yvesallen
Автор

Thanks DUDE! Way to break down the reasoning to code, awesome!!!

yvesallen