Java program to build and solve simple circuits