3. Replace the (????) with relevant code to run the program. Details about the program have been given below. (Java has been used) This program should display: Before: 27 19 34 5 12 After: 0 19 34 5 12 After: 0 0 34 5 12 */
3. Replace the (????) with relevant code to run the program. Details about the program have been given below. (Java has been used)
This program should display:
Before:
27 19 34 5 12
After:
0 19 34 5 12
After:
0 0 34 5 12
*/
package finalexamtakehome6;
public class Finalexamtakehome6 {
//
public void print ( int[] x )
{
while ( int j=0; j < x.length; j++ )
System.out.print( x[0] + " " );
System.out.println( );
}
public void changeElement ( int[] x, int elt )
{
if ( elt x.length )
x[ elt ] = 0;
}
//
public static void main(String[] args) {
Finalexamtakehome6 cng = new Finalexamtakehome6();
int[] value = {27, 19, 34, 5, 12} ;
int chgelt = 0;
System.out.println( "Before:" );
cng.print( value );
cng.changeElement( value, chgelt );
System.out.println( "After:" );
cng.print( value );
chgelt = chgelt;
cng.changeElement( ????, chgelt );
System.out.println( "After:" );
cng.print( value );
}
}

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images









