public class Decoder { int inputs; int functions; int outputs; //Constructor accepts two parameters. One represents the number of //inputs and the other the number of functions to be implemented. //Also initializes the class variable "outputs." public Decoder(int in, int f) { inputs = in; functions = f; //Calculates the number of outputs based on the number of inputs. //Recall that if x is the number of inputs, 2^x is the number of //outputs. outputs = (int) Math.pow(2,inputs); } //Main method is used to ensure program executes as desired. public static void main(String[] args) { //Creates an Decoder object. Decoder decoderCircuit = new Decoder(3,2); //Uses decoder object reference variable to call description() //method to make sure the an Decoder object was created based on //the desired specifications. decoderCircuit.description(); } public void description() { //Prints out the specifications of the Encoder object. System.out.println ("This decoder has " + inputs + " inputs and " + outputs + " outputs. It represents " + functions + " functions."); } }