Question: I need your help with my code I have no idea why it not working !! the code keeps printing (Infinity) ?! (The problem that
I need your help with my code I have no idea why it not working !!
the code keeps printing (Infinity) ?!
(The problem that Chegg doesnt allow me to paste the hall code what should I do ?? ) I just want u to change this method in my code including everything just show me how I can rewrite it in a totally different way plz...
Specially from this part I need a lot of change and I need it to work as expected, or If u can just give me ur email in the comments below, so I can send u the hall code :)
-----------------------------------------------------------------------------
if ( (Per_capita_daily_usage == 315)||(Per_capita_daily_usage == 287)||(Per_capita_daily_usage == 295)||(Per_capita_daily_usage == 689)||(Per_capita_daily_usage ==269) ||(Per_capita_daily_usage == 111)||(Per_capita_daily_usage== 154)||(Per_capita_daily_usage== 91)) { pw.printf("\t %-13s%,-20d%,-32d%-33d %s ", years [Index_Of_Region][Index_Of_city][j], population [Index_Of_Region][Index_Of_city][j], water_usage [Index_Of_Region][Index_Of_city][j], Per_capita_daily_usage, "NA"); } else { int firstYear = 0; // Percentage change of per capita = [(This Year Last Year) / Last Year] x 100 double Percentage_change_of_per_capita = ( (double) (Per_capita_daily_usage - firstYear) / firstYear) * 100; pw.printf("\t %-13s%,-20d%,-32d%-33d %s ", years [Index_Of_Region][Index_Of_city][j], population [Index_Of_Region][Index_Of_city][j], water_usage [Index_Of_Region][Index_Of_city][j], Per_capita_daily_usage, Percentage_change_of_per_capita); //firstYear = Per_capita_daily_usage; System.out.println(Percentage_change_of_per_capita);
--------------------------------------------------------------------------------------------------------this is my code
final int WATER_USAGE = 1000; for (int j = 0; j
--------------------------------------------------------------------------------- this is the required output and some info about it

Command Description Command #4 print_result It prints details about the year, population, annual water usage, per capita daily usage and change (in percentage) of the specific city in a region. It takes the name of the region as the first argument, the name of the city as the second argument. All these arguments are separated with a space. print result Riyadh Ar-Riyad Example Output of the Example [Command] print_result Region: Riyadh -> City: Ar-Riyad Year Population Annual Water Usage (cb.m) Per capita daily usage (1) Change 2018 2019 2020 5,516,374 4,503,744 4,564,633 635,495,744 638,347,384 650,736,422 315 388 390 NA 23.17% 0.52% Command Description Command #4 print_result It prints details about the year, population, annual water usage, per capita daily usage and change (in percentage) of the specific city in a region. It takes the name of the region as the first argument, the name of the city as the second argument. All these arguments are separated with a space. print result Riyadh Ar-Riyad Example Output of the Example [Command] print_result Region: Riyadh -> City: Ar-Riyad Year Population Annual Water Usage (cb.m) Per capita daily usage (1) Change 2018 2019 2020 5,516,374 4,503,744 4,564,633 635,495,744 638,347,384 650,736,422 315 388 390 NA 23.17% 0.52%
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
