Neablis 0 Newbie Poster

Hello, ive been working on this code to evaluate infix notation for a while now, and i cant get it to work no matter what. I keep getting back 195 and it much be something that i just cant see... Thanks for any help.

public Character evaluate( String input){
	
          System.out.println( input );
          
          char a = 'a';
          char b = 'b';
          long first = 0;
          long second = 0;
          long results = 0;
          char returnVal = 'a';
          
          CS3ProjectStack<Character> stack2 = new CS3ProjectStack<Character>();
          
        char result = 0;
        
        for (int j = 0; j < input.length(); j++) {
            
            char ch = input.charAt(j);
          
            
            switch (ch) {
                
            case '+':
                try{
                    first = stack2.pop() - 0;
                    second = stack2.pop() - 0;
                    
                }catch( Exception e ){
                    System.out.println( "error with pop" );
                }
                int resultOfInt =  a + b;
               
                result = (char) resultOfInt;
                stack2.push(result);
                break;
                
            case '-':
                try{
                    first = stack2.pop();
                    second = stack2.pop();
                }catch( Exception e ){
                    System.out.println( "error" );
                }
                resultOfInt =  a + b;
         
                result = (char) resultOfInt;
                stack2.push(result);
                break;
                
            case '*':
                try{
                    first = stack2.pop();
                    second = stack2.pop();
                }catch( Exception e ){
                    System.out.println( "Error line 90" );
                }   
                resultOfInt =  a + b;
              
                                result = (char) resultOfInt;
				stack2.push(result);
				break;
            case '/':
                try{
                    first = stack2.pop();
                    second = stack2.pop();
                }catch( Exception e ){
                    System.out.println("Error line 101" );
                }
                resultOfInt =  a + b;
        
                                result = (char) resultOfInt;
				stack2.push(result);
				break;
            default:
                stack2.push(ch);
                break;
            }
            
            
        }
        try{
            returnVal = stack2.pop();
        }catch( Exception c ){
            System.out.println( c );
        }
        
        return returnVal;
      }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.