Generate each countries' average life expectancy by gender. •Life Expectancy Data (first column is a country code, second column is a year, third column is male life expectancy, and fourth column is...

1 answer below »

Generate each countries' average life expectancy by gender.


•Life Expectancy Data (first column is a country code, second column is a year, third column is male life expectancy, and fourth column is female life expectancy) (countries start from U to Z: Uganda, Ukraine, UAE, UK, US, USVI, Uruguay, Uzbekistan, Vanuatu, Venezuela, Vietnam, Yemen, Zambia, Zimbabwe) à please submit the entire package


Sample runs:


Uganda's average male life expectancy is 58.69
Uganda's average female life expectancy is 61.62


Ukraine's average male life expectancy is 71.01
Ukraine's average female life expectancy is 74.56


UAE's average male life expectancy is 76.80
UAE's average female life expectancy is 80.64


UK's average male life expectancy is 80.92
UK's average female life expectancy is 84.97


US's average male life expectancy is 78.70
US's average female life expectancy is 82.63


USVI's average male life expectancy is 78.76
USVI's average female life expectancy is 82.70


Uruguay's average male life expectancy is 77.04
Uruguay's average female life expectancy is 80.89


Uzbekistan's average male life expectancy is 70.76
Uzbekistan's average female life expectancy is 74.30


Vanuatu's average male life expectancy is 71.46
Vanuatu's average female life expectancy is 75.03


Venezuela's average male life expectancy is 74.06
Venezuela's average female life expectancy is 77.76


Vietnam's average male life expectancy is 75.67
Vietnam's average female life expectancy is 79.46


Yemen's average male life expectancy is 64.26
Yemen's average female life expectancy is 67.48


Zambia's average male life expectancy is 59.64
Zambia's average female life expectancy is 62.63


Zimbabwe's average male life expectancy is 57.61
Zimbabwe's average female life expectancy is 60.49


Answered Same DayJun 10, 2021

Answer To: Generate each countries' average life expectancy by gender. •Life Expectancy Data (first column is a...

Aaditya D answered on Jun 10 2021
153 Votes
import java.util.Scanner;
public class Main {
public static void main (String[] args) {
Scanner inputm=new
Scanner(System.in);
System.out.println("Enter the size of array to be calcuted for male life expectancy:");
int m=inputm.nextInt();
double totalm=0;
double arraym[]=new double[m];
System.out.println("Enter the elements one by one:");
for (int s=0;s arraym[s]=inputm.nextDouble();
}
for(int i=0;i totalm=totalm+arraym[i];
}
double averagem=totalm/m;
System.out.println("The averag male life expectency is:"+averagem);
Scanner inputf=new Scanner(System.in);
System.out.println("Enter the size of array to be calcuted for female life expectancy:");
int f=inputf.nextInt();
double totalf=0;
double arrayf[]=new double[f];
System.out.println("Enter the elements one by one:");
for (int s=0;s arrayf[s]=inputf.nextDouble();
}
for(int i=0;i totalf=totalf+arrayf[i];
}
double...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here