coding practice, compile errors, potential logical issues, etc.) (Use question 1 template)
1 public class AverageCalculator {
public static void main(String[] args) {
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 }
26
}
Scanner scanner = new Scanner(System.in);
ArrayList<Double> NUMBERS = new ArrayList<>();
int avg;
System.out.print("Enter the number of values to calculate the average: ");
int NumValues scanner.nextInt();
double sum 0;
for (int i=0; i NumValues; i++) {
}
System.out.print("Enter value #"+i+": ");
double value scanner.nextDouble();
NUMBERS.add(value);
sum += value;
if (NumValues != 0) {
double average sum / NumValues;
System.out.println("The average is: " + average);
} else {
}
System.out.println("No values provided. Cannot calculate the average.");
Zoom
Question 2 (3 points): Assuming you are assigned to conduct the component test for the method
+ 100%
Close