Question: I need your help in writing the code in a completely different way. Don't just change the names, variables, or locations. I need to write
I need your help in writing the code in a completely different way. Don't just change the names, variables, or locations. I need to write the whole code in a radically different way with everything because of plagiarism in this code. This is the required output shape of the code and some important information about it
---------------------------------------------------------------------------------------------------------------------------------
(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...
---------------------------------------------------------------------------------------------------------------------------------------------- the code
//get region index by name String reg = in.next(); //loop throug all regions in the Array and return the index int regIndex = FindRegion(region, reg);
//get City index by name String City = in.next();
//loop throug all City in the Array and return the index int CityIndex = FindCity(Citise, regIndex, City);
out.println("[Command] print_result"); out.println(" -> Region: " + region[regIndex]); out.println(" -> City: " + Citise[regIndex][CityIndex]); out.println(" ---------------------------------------------------------------------------------------------------------------"); out.printf(" %-12s%-15s%-35s%-35s%s ", "Year", "Population", "Annual Water Usage (cb.m)", "Per capita daily usage (l)", "Change"); out.println(" ---------------------------------------------------------------------------------------------------------------");
int PrivYear = 0; for (int i = 0; i
String Year = Years[regIndex][CityIndex][i]; int Pop = population[regIndex][CityIndex][i]; long WU = WaterU[regIndex][CityIndex][i];
/* 1 cb.m = 1000 liters */ double WU_Inliters = WU * 1000.0;
//(total population x 365) double totalPop = Pop * 365.0;
// Per capita daily usage (liters) = Total water usage in liters/ (total population x 365) //Per capita daily usage int PCDU = (int) (WU_Inliters / totalPop);
if (i == 0) { PrivYear = PCDU; out.printf(" %-12s%,-15d%,-35d%-35d%s ", Year, Pop, WU, PCDU, "NA"); continue; }
// Percentage change of per capita double PCOPC = ((double) (PCDU - PrivYear) / PrivYear) * 100;
out.printf(" %-12s%,-15d%,-35d%-35d%.2f%% ", Year, Pop, WU, PCDU, PCOPC);
PrivYear = PCDU;
} out.println(" --------------------------------------------------------------------------------------------------------------- ");
--------------------------- this is the required output and some details about the code

Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
