// Fall09 Exam 2 Programming Exam  
 // State object class for DFA.java  
 // dependencies: none  

public class State {
 // instance variables 
    private String type;
    private int next0;
    private int next1;
  
 // constructor sets up the instance variables 
    public State(String type, int next0, int next1) {
        this.type = type;
        this.next0 = next0;
        this.next1 = next1;
    }

 // return type of this state 
    public String type() {
        return this.type ;
    }
  
 // transition to next state based on input char 
    public int next(char c) {
        if (c  == '0') return next0;
        else return next1;
    }
  
}