Question: Given the following Java programming code as shown in Figure Q2(b)(i) . Identify and correct the errors by filling them in Table Q2(b)(i) if there
- Given the following Java programming code as shown in Figure Q2(b)(i). Identify and correct the errors by filling them in Table Q2(b)(i) if there are any errors. What is the output of the program after the corrections have been made?
| Line No | Programming code |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Public class Q2_c {
public static int main string[] args) { int a = 5; double b = 4.0; double c = 6.0; int m = compute(a, b, c) System.out.println(m); System.out.printc(Math.rnd(-8.6)); // rounding number }
public static double compute (double x, int y, double z) { return ( ( x + y) y-- * 6;
} |
Figure Q2(b)(i): Programming code
Table Q2(b)(i): Errors and Correction
| Line No | Error | Correction |
| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
[10 marks]
urgent. do in netbean JAVA
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
