This randomDecimal method should assign a random double number (in the range 0.0 to less than 50.0) to double number and dispThis randomDecimal method should assign a random double number (in the range 0.0 to less than 50.0) to double number and display it in displayJLabel. Find the error(s) in the following code.lay it in displayJLabel. Find the error(s) in the following code.

```
1 private void randomDecimal()
2 {
3 double number;
4 Random randomObject = new Random();
5
6 number = randomObject.nextDouble();
7 displayJLabel.setText = String.valueOf( number );
8
9 } // end method randomDecimal
```


This code gives a random number between 0.0 and less than 1.0, not between 0.0 and less than 50.0. Also, displayJLabel.setText is a method, so a value cannot be assigned to it.
```
1 private void randomDecimal()
2 {
3 double number;
4 Random randomObject = new Random();
5
6 number = 50 * randomObject.nextDouble();
7 displayJLabel.setText( String.valueOf( number ) );
8
9 } // end method randomDecimal
```

Computer Science & Information Technology

You might also like to view...

The citation for information copied from a web page includes the web site's ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

Which of the following is not controlled by a PivotTable style?

A) bold fonts B) subtotal calculations C) borders D) row and column shading

Computer Science & Information Technology

Only specifically-configured systems can use _______________.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Almost all the ____________________ ISP routers properly forward IPv6 packets.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology