public class Circuits { public static void main(String[] args) { //Creates two Decoder objects and two Gates objects //and assigns them to reference variables. Notice the //two integers as parameters to be passed to //the constructors when the objects are created. Decoder circuit1 = new Decoder(4,5); Decoder circuit2 = new Decoder(8,23); Gates circuit3 = new Gates(3,4); Gates circuit4 = new Gates(7,5); //Uses the references to the already created Encoder //objects to call their description() methods. circuit1.description(); circuit2.description(); //Uses the references to the Gates objects to call //the setor() methods for each object. Notice the methods //take an integer value as a parameter. circuit3.setor(23); circuit4.setor(35); //Since the Gates class does not have a method that prints out //the information about each Gates object, the variables and methods //from each object must be imbedded in text (as shown.) Notice that //the object references must be used to access the variables and methods //of the two different Gates objects. /* System.out.println("This circuit has " + circuit3.inputs + " inputs and implements " + circuit3.functions + " functions. There are " + circuit3.getor() + " or gates and " + circuit3.andgates + " and gates available to" + " make this circuit."); System.out.println("This circuit has " + circuit4.inputs + " inputs and implements " + circuit4.functions + " functions. There are " + circuit4.getor() + " or gates and " + circuit4.andgates + " and gates available to" + " make this circuit."); */ circuit3.description(); circuit4.description(); } }