1. Engineering
  2. Computer Science
  3. the following program supposes to calculate the area of a...

Question: the following program supposes to calculate the area of a...

Question details

The following program supposes to calculate the area of a rectangle and produce the following output. Area of rectangle = 20 Unfortunately, the program has Compile-time and Run-time errors that prevent the program from running and producing the correct result. Using the table 2.1 below, allocate the error(s) on each program line. 1 class Rectangle{ 2 int length 3 Int width; 4 viod insert(int l, int w){ 5 length == l; 6 width = ww; 7 8 void calculateArea( { 9 System.out.println("Area of rectangle = "+ length / width);} 10 } 11 class TestRectangle1{ 12 public void main(String args[]){ 13 Rectangle r1 = Rectangle(); 14 r.insert(5,4); 15 r1.calculatearea(); 16 }} 17 }

Line No

Compile-time / Run-time error

1

No error

2

Missing semicolon ; at the end of line

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution