- #1
Pearce_09
- 74
- 0
Programming problem!
hello,
This might be a simple answer, but I'm not sure because I am very un-familiar with programming.
also I am not sure if this can be answered (becuase I am not giving enough information)
__________________________________________________________
public static String[] findAndReplace( String[] in, String[] what, String[] with ) {
// Implement this method.
return null;
public static void main( String[] args ) {
displayStudentInfo();
String[] text;
text = new String[ 10 ];
text[ 0 ] = new String( "I" );
text[ 1 ] = new String( "have" );
text[ 2 ] = new String( "never" );
text[ 3 ] = new String( "let" );
text[ 4 ] = new String( "my" );
text[ 5 ] = new String( "schooling" );
text[ 6 ] = new String( "interfere" );
text[ 7 ] = new String( "with" );
text[ 8 ] = new String( "my" );
text[ 9 ] = new String( "education" );
String[] query;
query = new String[ 3 ];
query[ 0 ] = text[ 0 ];
query[ 1 ] = text[ 1 ];
query[ 2 ] = text[ 4 ];
String[] replacement;
replacement = new String[ 3 ];
replacement[ 0 ] = new String( "You" );
replacement[ 1 ] = new String( "should" );
replacement[ 2 ] = new String( "your" );
String[] result;
result = findAndReplace( text, query, replacement );
if ( result == null ) {
System.err.println( "findAndReplace should not return a null value" );
System.exit( 1 );
}
___________________________________
I am having trouble with my program right here, I don't know what I have to put so the programm will continue and not exit every time... Here is the rest of the program... its unfinished..
// We now know that result cannot be null
for ( int i=0; i<result.length; i++ ) {
if ( i > 0 ) {
System.out.print( " " );
}
System.out.print( result[ i ] );
}
System.out.println( "." );
}
}
_________________________________
my output needs to be "You should never let your schooling interfere with your education"... I just need help getting past the "System.exit(1)..
thank you for your time..
adam
hello,
This might be a simple answer, but I'm not sure because I am very un-familiar with programming.
also I am not sure if this can be answered (becuase I am not giving enough information)
__________________________________________________________
public static String[] findAndReplace( String[] in, String[] what, String[] with ) {
// Implement this method.
return null;
public static void main( String[] args ) {
displayStudentInfo();
String[] text;
text = new String[ 10 ];
text[ 0 ] = new String( "I" );
text[ 1 ] = new String( "have" );
text[ 2 ] = new String( "never" );
text[ 3 ] = new String( "let" );
text[ 4 ] = new String( "my" );
text[ 5 ] = new String( "schooling" );
text[ 6 ] = new String( "interfere" );
text[ 7 ] = new String( "with" );
text[ 8 ] = new String( "my" );
text[ 9 ] = new String( "education" );
String[] query;
query = new String[ 3 ];
query[ 0 ] = text[ 0 ];
query[ 1 ] = text[ 1 ];
query[ 2 ] = text[ 4 ];
String[] replacement;
replacement = new String[ 3 ];
replacement[ 0 ] = new String( "You" );
replacement[ 1 ] = new String( "should" );
replacement[ 2 ] = new String( "your" );
String[] result;
result = findAndReplace( text, query, replacement );
if ( result == null ) {
System.err.println( "findAndReplace should not return a null value" );
System.exit( 1 );
}
___________________________________
I am having trouble with my program right here, I don't know what I have to put so the programm will continue and not exit every time... Here is the rest of the program... its unfinished..
// We now know that result cannot be null
for ( int i=0; i<result.length; i++ ) {
if ( i > 0 ) {
System.out.print( " " );
}
System.out.print( result[ i ] );
}
System.out.println( "." );
}
}
_________________________________
my output needs to be "You should never let your schooling interfere with your education"... I just need help getting past the "System.exit(1)..
thank you for your time..
adam