// purpose: practice string manipulation import java.util.*; import java.io.*; public class TwoLinesFromFile { // method main(): program starting point public static void main( String[] args ) throws IOException { // set up input scanner Scanner stdin = new Scanner( System.in ); // get name of file to be processed System.out.print( "What is your file: " ); String s = stdin.next(); // get a representation of the file File f = new File( s ); // get connection to the file Scanner reader = new Scanner( f ); // get data from the file String line1 = reader.nextLine(); String line2 = reader.nextLine(); // ******* get the indices for getting the jpg name int i1 = 0; int i2 = 0; // ******* get the substring giving the name of the jpg String jpg = ""; // ******* get the indices for getting the forecast int i3 = 0; int i4 = 0; // ******* get the substring giving the forecast String forecast = ""; // display image name and forecast System.out.println( "jpg = " + jpg ); System.out.println( "forecast = " + forecast ); } }