% hw031.m
%  When does the wind turbine technician population (increasing) exceed the
%  newspaper reporter population (decreasing)?
%
year = 2017;
w_pop = 4400;
w_rate = 0.075;
r_rate = - 0.045;
r_pop = 41500;

while ( w_pop < r_pop )
  year = year + 1;
  w_pop = w_pop * ( 1.0 + w_rate );
  r_pop = r_pop * ( 1.0 + r_rate );  
end

fprintf ( 'In the year %d:\n', year );
fprintf ( '  Wind turbine technician population is  %.0f\n', w_pop );
fprintf ( '  Reporter population is                 %.0f\n', r_pop );
