src/Reader.java
/**
     * parses the Food file into an Array of Foods
     */
parses the Food file into an Array of Foods
parses the Food file into an Array of Foods
public void food() {
        this.food = new int[3][2];
        try {
            String w = cr.readLine();
            if (w == null || w.isEmpty()) {
                JOptionPane.showMessageDialog(null, "No Saved Game",
                        "Error", JOptionPane.ERROR_MESSAGE);
            }
            String[] tempy = w.split(";");
            if (tempy.length == 2) {
                this.name = tempy[0];
                this.score = Integer.parseInt(tempy[1]);
            }
            for (int v = 0; v < food.length; v++) {
                String b = cr.readLine();
                if (b.isEmpty() || b == null) {
                    break;
                } else {
                    String[] high = b.split(";");
                    if (high.length != 2 || high == null) {
                        break;
                    }
                    food[v][0] = Integer.parseInt(high[0]);
                    food[v][1] = Integer.parseInt(high[1]);
                }
            }           
        } catch (IOException e) {
        }
    }
public void food ( ) { this . food = new int [ 3 ] [ 2 ] ; try { String w = cr . readLine ( ) ; if ( w == null || w . isEmpty ( ) ) { JOptionPane . showMessageDialog ( null , "No Saved Game" , "Error" , JOptionPane . ERROR_MESSAGE ) ; } String [ ] tempy = w . split ( ";" ) ; if ( tempy . length == 2 ) { this . name = tempy [ 0 ] ; this . score = Integer . parseInt ( tempy [ 1 ] ) ; } for ( int v = 0 ; v < food . length ; v ++ ) { String b = cr . readLine ( ) ; if ( b . isEmpty ( ) || b == null ) { break ; } else { String [ ] high = b . split ( ";" ) ; if ( high . length != 2 || high == null ) { break ; } food [ v ] [ 0 ] = Integer . parseInt ( high [ 0 ] ) ; food [ v ] [ 1 ] = Integer . parseInt ( high [ 1 ] ) ; } } } catch ( IOException e ) { } }
parses the Food file into an Array of Foods
parses the Food file into an Array of Foods