Modify the following code to produce the output shown. Use proper indentation tech- niques. You may not make any changes other than inserting braces and changing the indentation of the code. The interpreter ignores indentation in a JavaScript program. We have eliminated the indentation from the following code to make the problem more chal- lenging. [Note: It is possible that no modification is necessary.]

```
if ( y == 8 )
if ( x == 5 )
document.writeln( "@@@@@
" );
else
document.writeln( "#####
" );
document.writeln( "$$$$$
" );
document.writeln( "&&&&&
" );
```
a) Assuming x = 5 and y = 8, the following output is produced.
@@@@@
$$$$$
&&&&&

b) Assuming x = 5 and y = 8, the following output is produced.
@@@@@

c. Assuming x = 5 and y = 8, the following output is produced.
@@@@@
&&&&&

d) Assuming x = 5 and y = 7, the following output is produced. [Note: The last three output statements after the else
are all part of a compound statement.]
#####
$$$$$
&&&&&

a.
```
1 if ( y == 8 ){
2 if ( x == 5 )
3 document.writeln( "@@@@@
" );
4 else
5 document.writeln( "#####
" );
6
7 document.writeln( "$$$$$
" );
8 document.writeln( "&&&&&
" );
9 }
```

b.
```
1 if ( y == 8 ){
2 if ( x == 5 )
3 document.writeln( "@@@@@
" );
4 else{
5 document.writeln( "#####
" );
6 document.writeln( "$$$$$
" );
7 document.writeln( "&&&&&
" );
8 }
9 }
```

c.
```
1 if ( y == 8 ){
2 if ( x == 5 )
3 document.writeln( "@@@@@
" );
4 else{
5 document.writeln( "#####
" );
6 document.writeln( "$$$$$
" );
7 }
8 document.writeln( "&&&&&
" );
9 }
```

d.
```
1 if ( y == 8 ){
2 if ( x == 5 )
3 document.writeln( "@@@@@
" );
4 else{}
5 }
6
7 document.writeln( "#####
" );
8 document.writeln( "$$$$$
" );
9 document.writeln( "&&&&&
" );
```

Computer Science & Information Technology

You might also like to view...

It is a good practice to print column and row labels on each page

Indicate whether the statement is true or false

Computer Science & Information Technology

Object ____ makes a new object available to a program.

A. orientation B. definition C. instantiation D. access

Computer Science & Information Technology