Creating an Array
From CompSciWiki
Back to the Program-A-Day homepage
ProblemThere are ten students with ten grades. Instead of storing every single grade in a single variable it is easier to store this information in an array. Given that the grades are 56%, 34%, 75%, 89%, 78%, 87%, 71%, 67%, 98%, 85%, store the grades in an integer array as percents and convert them to decimals and store them in a double array. |
SideSectionTitle
An image or By Students section | |
---|---|---|
Solutionpublic class Creating{ public static void main(String[] args){ int[] intArray = {56, 34, 75, 89, 78, 87, 71, 67, 98, 85}; double[] decimalArray = {0.56, 0.34, 0.75, 0.89, 0.78, 0.87, 0.71, 0.67, 0.98, 0.85}; } } | ||
CodeSolutionCode goes here. Please DO NOT put your code in <pre> tags! |