I have an array with the total population of a country and another array with the total number of cases of COVID for each country. I need to divide the number of cases by the total population and store the percentage in a third array. I'm stuck on the syntax though and no one from my class is available for outreach until tomorrow. Can anyone please help me get past this step? I've tried lots of different ways of getting the new percentage array, but nothing works. I can't use int for the percentage because my professor wants it with four places after the decimal. No references in the examples or the book match what I'm trying to do.
Thanks in advance for your advice!
int[] cases = {10_036_282, 8_553_657, 5_675_032, 1_856_292, 1_781_997, 1_381_218, 1_250_499, 1_216_747, 1_149_068, 967_825};
int[] population = {327_096_265, 1_352_647_786, 209_469_323, 64_990_511, 145_734_038, 46_692_858, 44_361_150, 67_141_684, 49_661_048, 126_190_788};
//You must calculate the percentage of cases based on the number of cases and the population.
for (int i = 0; i < countries.length; i++){
double percentage[i] = ((cases[i] / population[i]) * 100);
}