Jo Shoe

Greenhorn
+ Follow
since Nov 18, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jo Shoe

I have never posted to a forum, so if I am not doing something right please let me know. I am trying to do a review for a mid-term this week. I figured out the other 21 but I have 2 problems I cannot solve. I am unable to figure what needs to go into the areas marked with instructions. If I could get a hint. I have tryed for the last 4 days ... and don't know where else to go. These practice exercises are at the end of the chapter on I/O and serialization. I cannot find an example in the book to try to understand. I also looked all over on the internet to find a hint. Thank you.

Jo

class Complete3_1 {
char[] someChars;
public void initialize( String fileName,
int maxCharCount ) {

// fINISH THE INITIALIZE METHOD SO THAT IT FILLS THE CHARACTER ARRAY WITH CHARACTERS READ FROM THE SPECIFIED FILE

}
public String toString() {
return new String( someChars );
}
public static void main( String[] args ) {
if ( args.length >= 1 ) {
Complete3_1 a = new Complete3_1();
a.initialize( args[0], 100 );
System.out.println( a );
} else {
System.out.println( "A filename is required." );
}
}
}




package questions.c3;
class Complete3_2 {
String fileChunk;
int value;
public void getInt( String fileName, int start )
{

// FINISH THE getInt METHOD SO THAT IT READS AN INTEGER FROM THE SPECIFIED STARTING POSITION IN THE SPECIFIED FILE

}
public String toString() {
return String.valueOf( value );
}
public static void main( String[] args ) {
if ( args.length >= 1 ) {
Complete3_2 a = new Complete3_2();
a.getInt( args[0], 10 );
System.out.println( a );
} else {
System.out.println( "A filename is required." );
}
}
}


17 years ago