i want to Write a program that can serve as simple calculater in java programing that can add , subtract , multiply and divide
this example that i want to it look like
Calculator is on.
Result =0.0
+5
Result +5.0 =5.0
New result =5.0
*2.2
Result * 2.2=11.0
Update result = 11.0
%2.2
% is unknown operater
Please Reenter

so anyone know or help please?

You forgot few elementary things

  1. Will this be command line application or swing?
  2. What did you do so far? Please provide your code...

i want to Write a program that can serve as simple calculater. This calculator keep track of a single number (of type double) that is call result and start out 0.0. each cycle allow user to repeatedly add, subtract, multiply and divide by the second number. The result of one of these operation become the new value of result. And if the user enters any operator symbol other than +, -, * ,or / , then an unknowOperator exception is shrow and an the user aske to recenter that line of input.
Example:
Calculator is on.
Result =0.0
+5
Result +5.0 =5.0
New result =5.0
*2.2
Result * 2.2=11.0
Update result = 11.0
%2.2
% is unknown operater
Please Reenter
---------------------------
PS: it does not work , the code is a lot of error , i dont know how to solve it so please
--------------------------------This my code-----------------------------------------------------------

import java.io.*;  
import java.math.*;  
public class calculaterDamo {
static String  myString;
		private static double numMul2;  

		public static void main(String[] args) throws Exception{  
		 
		 System.out.println(" Press Enter Key...........");  
         
	        try{  
	        System.in.read();  
	        }  
	          
	        catch(IOException e){  
	          
	            return;  
	        }  
	}
	    
	     
	   public static boolean checkInput(String str){  
	     
	   int stringLength = str.length();  
	   if(stringLength >= 300){return false;}  
	   for(int i = 0; i<stringLength -1; i++)  
	       if(str.charAt(i)<=0 || str.charAt(i)>= 9)  
	           return false;  
	     
	   return true; 
	   }
        
        boolean isValidInput;  
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));  
          
       Calculater  choice = new  Calculater();  
         while(choice != 0){  
             switch(choice){  
                 case 0:  
                     return;  
   case 1:  
                     //Add two numbers code codes  
                     System.out.println("\n Enter First Number");  
                     String str = input.readLine();  
                     isValidInput = checkInput(str);  
                     if(isValidInput == true){  
                     numAdd1 = Double.parseDouble(str);  
                     }  
                     else {   
                         System.out.println("\n input error");  
                     }  
                       
                     System.out.println("\n Enter Second Number");  
                      str = input.readLine();  
                     isValidInput = checkInput(str);  
                     if(isValidInput == true){  
                     numAdd2 = Double.parseDouble(str);  
                     double numAddSum = add(numAdd1,numAdd2);  
                       
                     System.out.println("\n the sum is = " + numAddSum +" \n");  
                     }  
   else {  System.out.println("\n input error");  
   }  
   main();  
   Calculater();  
   break;  
     
   case 2:  
   // code for substracting two numbers  
   System.out.println("\n Enter First Number");  
   numSub1 = Double.parseDouble(input.readLine());  
   System.out.println("\n Enter Second Number");  
   numSub2 = Double.parseDouble(input.readLine());  
   double numSub = sub(numSub1 ,numSub2);  
    System.out.println("\n thediferecne is = " + numSub +" \n ");  
 
   main();  
   Calculater();  
   break;  
 
   case 3:  
   // code for multiplying two numbers  
   System.out.println("\n Enter First Number");  
   numMult1 = Double.parseDouble(input.readLine());  
   System.out.println("\n Enter Second Number");  
   numMul2 = Double.parseDouble(input.readLine());  
   double numMul = multiply(numMult1 ,numMul2);  
    System.out.println("\n theMultiplication is = " + numMul +" \n ");  
 
     
   main();  
   Calculater();  
   break;  
 
   case 4:  
   // code for Dividing two numbers  
   System.out.println("\n Enter First Number");  
   numDiv2 = Double.parseDouble(input.readLine());  
   System.out.println("\n Enter Second Number");  
   numDiv2 = Double.parseDouble(input.readLine());  
   double numDiv = divide(numDiv2 ,numDiv2);  
    System.out.println("\n theDivision is = " + numDiv +" \n ************");  
     
 
   main();  
   Calculater();  
   break;  
 
  
 
   
   
             }


         }
	
}
}

------------------ another class-----------
t java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Calculater {  
    static double numAdd1 = 0,numAdd2 = 0;  
    static double numSub1 = 0,numSub2 = 0,numMult1 = 0;  
    static double numMult2 = 0,numDivi21 = 0,numDiv2 = 0;  
   
    public static int Calculater() throws Exception {  
       // BufferedReader input = new BufferedReader(new InputStreamReader(System.in));  
        System.out.println(" Ccalculator \n ");  
          
        System.out.println(" 0: \t Exit()");  
        System.out.println(" 1:\tAdd two Numbers");  
        System.out.println(" 2:\tSubstract two Numbers");  
        System.out.println(" 3:\tMultiply two Numbers");  
        System.out.println(" 4:\tDivide two Numbers");  
  
          
        //choice = Integer.parseInt(input.readLine());  
        //return choice;  
          
    }  
  
    // calculate the Addition of two numbers  
    public static double add(double numAdd1,double numAdd2)  
    {  
    return numAdd1 + numAdd2;  
      
    }  
    public static double sub(double numSub1,double numSub2)  
    {  
    return numSub1 - numSub2;  
      
    }  
      
    public static double multiply(double numMul1,double numMul2)  
    {  
    return numMul1 * numMul2;  
      
    }  
      
    public static double divide(double numDiv1,double numDiv2)  
    {  
    return numDiv1/ numDiv2;  
      
    }  
   
}

no, we're not going to try to make sense of a mess of unformatted code.
And no, we're not going to fix your mistakes for you.
Ask specific questions about specific errors, showing the actual errors, and we may provide you with hints as to their solutions.

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.