SWT301_-_FALL24_-_PE3_3242.webp
Nezuko94

SWT301_-_FALL24_-_PE3_3242.webp

  • Media owner Nezuko94
  • Ngày thêm
Duration: 80 minutes
Instructions:
You need to know at least one programming language to perform reasonably well on certain exam questions.
Students are allowed to use IDEs such as NetBeans, IntelliJ IDEA, or similar software to do the test.
You will get 0 (zero) for any answer which contains information irrelevant to the corresponding question.
Question 1 (3 points): Review the following class and find (at least) 6 issues in the code (i.e.,coding practice, compile errors, potential logical issues, etc.) (Use question 1 template)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public class AverageCalculator {
public static void main(String[] args) {
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;
1
Zoom
+ 100%
Close
Chưa có bình luận nào.

Thông tin

Category
SWT301
Thêm bởi
Nezuko94
Ngày thêm
Lượt xem
3,623
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
SWT301_-_FALL24_-_PE3_3242.webp
File size
207.4 KB
Dimensions
1920px x 803px

Share this media

Back
Bên trên Bottom