Further down this page you can find immigration data for the top ten immigrant destination countries, borrowed from Wikipedia. Initialise a 2D array in Java with this data. Then, making use of loops where convenient to avoid unnecessary typing, get your program to answer the following questions or perform the following tasks.
Don't be afraid to Google for anything you don't know.
Absolutely avoid repeating anything in your program that you could use a loop for instead.
Use casting where necessary to transform your array objects into the types you need. For example, int value = (int)data; . If you continue to study Java, you'll discover better ways of dealing with this situation later on, avoiding error-prone casts. If you already know these ways, feel free to use them.
Start with adding one line of data to a 1D array of Object. Check you can access all the elements, and that you can add numbers from the array together. Then try a 2D array with two rows of data, before moving onto the full thing.
Formatting so much data into a 2D array is tedious; make sure you use copy and paste as much as possible and have some kind of system to formatting the array. If you continue to study Java, eventually you'll know how to read data from files and won't need to do this kind of thing. Meanwhile, it's good for the soul, as my former boss used to say.
You may get stuck. This is normal; the longer you can spend thinking about the problem, trying out possible solutions and Googling for answers without getting demotivated, rather than just looking at the solution, the better! Wrestling with coding problems hugely builds your understanding of programming.
|Country||Number of Immigrants||Percentage of Total Immigrants in the World||Immigrants as Percentage of National Population|
|United Arab Emirates||7,826,981||3.4||83.7|
Country Immigrants % world total % population United States 45785090 19.80 14.30 Russia 11048064 4.80 7.70 Germany 9845244 4.30 11.90 Saudi Arabia 9060433 3.90 31.40 United Arab Emirates 7826981 3.40 83.70 United Kingdom 7824131 3.40 12.40 France 7439086 3.20 11.60 Canada 7284069 3.10 20.70 Australia 6468640 2.80 27.70 Spain 6466605 2.80 13.80 Total immigrants: 119048343 Total percentage of world's immigrants: ??? Country with least immigration: ??? Country with greatest immigration: ??? Total estimated population of all countries: ???