fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {switch(operator)
  12. {
  13. case '+':
  14. printf("num1+num2=%.2f",num1+num2);
  15. getch();
  16. break;
  17. case '-':
  18. printf("num1-num2=%.2f",num1-num2);
  19. getch();
  20.  
  21. default:
  22. printf("Operator is not correct");
  23. getch();
  24. break;
  25. }
  26. // your code goes here
  27. }
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:11: error: cannot find symbol
	{switch(operator)                              
	        ^
  symbol:   variable operator
  location: class Ideone
Main.java:11: error: illegal start of type
	{switch(operator)                              
	       ^
Main.java:14: error: cannot find symbol
                     printf("num1+num2=%.2f",num1+num2);
                                             ^
  symbol:   variable num1
  location: class Ideone
Main.java:14: error: cannot find symbol
                     printf("num1+num2=%.2f",num1+num2);
                                                  ^
  symbol:   variable num2
  location: class Ideone
Main.java:15: error: cannot find symbol
                     getch();
                     ^
  symbol:   method getch()
  location: class Ideone
Main.java:18: error: cannot find symbol
                    printf("num1-num2=%.2f",num1-num2);
                                            ^
  symbol:   variable num1
  location: class Ideone
Main.java:18: error: cannot find symbol
                    printf("num1-num2=%.2f",num1-num2);
                                                 ^
  symbol:   variable num2
  location: class Ideone
Main.java:19: error: cannot find symbol
                    getch();
                    ^
  symbol:   method getch()
  location: class Ideone
Main.java:22: error: cannot find symbol
                    printf("Operator is not correct");
                    ^
  symbol:   method printf(String)
  location: class Ideone
Main.java:23: error: cannot find symbol
                    getch();
                    ^
  symbol:   method getch()
  location: class Ideone
10 errors
stdout
Standard output is empty