import java.util.Random; public class Gates { int inputs; int functions; int andgates; private int orgates; //Constructor accepts two parameters one representing the number of //inputs and the other the number of functions to be implemented. //Also initializes the class variable "andgates." public Gates(int in, int f) { Random generator = new Random(); inputs = in; functions = f; //Assigns the variable "andgates" to a value between 15 and 30. andgates = generator.nextInt(16) + 15; } //Main method is used to ensure program executes as desired. public static void main(String[] args) { Gates gatesCircuit = new Gates(4, 7); gatesCircuit.setor(14); gatesCircuit.description(); } //Method accepts an integer as a parameter and sets the number of or gates //to that value. public void setor(int or) { orgates = or; } //Method returns the value of the private variable "orgates." public int getor() { return orgates; } public void description() { System.out.println(" Inputs are "+inputs+" Functions are "+functions+"And gates are "+andgates+" Orgates are "+orgates); } }