
-----------------------------------
Insectoid
Thu Oct 09, 2008 12:57 pm

ripple carry adder
-----------------------------------
Hi,

I decided to try to make a ripple carry adder. Because I'm like that, I decided to do it recursively. I am rather new to arrays in Java, which I wanted to use, and so I did. This is my first time using a non-static method, and it is a little bit over my head. The adder works (I did a half-adder and a full adder, now I'm adjusting the full adder to create my ripple carry adder, so the math bit works). 

The problem? Lots of them. Mostly syntax, but I can't find the problems. It says I need identifiers where there are identifiers, that I'm missing ';' on lines that have them, etc. 

Right now, it only has static input, so true = 1 and false = 0. Eventually I'll add in a binary converter, but right now, I want what I have to work.

Here's my code:


public class full_adder {

    
    public static void main (String [] args) {
    	int size_array = 1;
    	boolean []in_A =new boolean [size_array];
		boolean []in_B =new boolean [size_array];
        in_A [0] = true;
        in_A [1] = false;
        in_B [0] = false;
        in_B [1] = true;
		boolean in_C = false;
    	boolean [] sum = new boolean [size_array];
    	boolean out_C = false;
    	int counter = 0;
     
    	
    }	
    
    public static boolean adder (boolean a, boolean b, boolean c){
    	sum [counter] = (a ^ b)^c;
    	out_C = (a && b)||((a ^ b)&&c);
    	counter += 1;
    	return out_C;
    	if (counter 