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( "&&&&&
" );
```
You might also like to view...
Which type of structure is used to execute a set of instructions in the order in which they appear?
a. Decision structure b. Sequence structure c. Nested structure d. Do together structure e. None of these
Which of the following demonstrates that technology alone is not the answer to network security issues?
A) A user manually opens an e-mail attachment and releases a virus. B) A user keeps passwords on a Post-it note attached to their computer monitor. C) The network server is located in a room to which most employees have access. D) All of the above
JPEG files can display only 256 colors and tend to have large file sizes
Indicate whether the statement is true or false
Thrashing is a problem that occurs when there are a large number of jobs and many free pages so that pages are being moved around too much.
Answer the following statement true (T) or false (F)