Core java Selenium Software Testing
import java.io.*;
public class Assign1
{
public void calc() throws IOException
{
BufferedReader brr=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter operator");
String o=brr.readLine().trim();
System.out.println("Enter value of a");
// String a=brr.readLine();
int a1=Integer.parseInt(brr.readLine().trim());
System.out.println("Enter value of b");
// String b=brr.readLine();
int b1=Integer.parseInt(brr.readLine().trim());
int res = 0;
if(o.equals("+"))
{
res = a1+b1;
}
else if(o.equals("-"))
{
res = a1-b1;
}
System.out.println(res);
}
public static void main(String[] args) throws IOException
{
Assign1 add=new Assign1();
add.calc();
}
}
Comments