Modify to use a for loop.
What will be an ideal response?
```
public void increaseVolumeFor ( )
{
SoundSample [ ] sampleArray = this . getSamples ( ) ;
SoundSample sample = null ;
int value = 0 ;
int index = 0 ;
// loop through all the samples in the array
for ( int i = 0 ; i < sampleArray.length ; i++)
{
sample = sampleArray [ i ] ;
value = sample . getValue ( ) ;
sample . setValue ( value *2 ) ;
}
]
```
If you are using Java 1.5 or above modify it to use a for-each loop.
```
public void increaseVolumeForEach ( )
{
SoundSample [ ] sampleArray = this . getSamples ( ) ;
int value = 0 ;
// loop through a ll the samples in the array
for ( SoundSample sample : sampleArray )
{
value = sample . getValue ( ) ;
sample . setValue ( value * 2 ) ;
}
}
```
You might also like to view...
Which type of computer monitor utilizes two sheets of polarizing material to encompass a liquid crystal solution?
A. LED panel B. CRT monitor C. CRT panel D. LCD panel
List method _________ returns the number of times a specified element occurs in a list.
Fill in the blank(s) with the appropriate word(s).
Which tag is used to delineate cells in the body of a table?
(a) When creating a chart from data in a worksheet, the data series is surrounded by a(n) ________border Fill in the blank(s) with correct word
(c)
(d)