Answer:
public class num3 {
public static void main(String[] args) {
double yearlySales =0;
int [] monthlySales = new int[12];
for(int i = 0; i<monthlySales.length; i++) {
yearlySales= yearlySales += monthlySales[i];
}
}
}
Step-by-step explanation:
Declare the variable yearlySales and initialize to 0.
Create an Array of ints monthlySales, set its length to 12
Using a for loop, add up all the elements in array and store in the varible yearly sales.