public class jisuan {
public static void main(String[] args) {
int result;
Core core=new Core();
}
}
class Core{
String op;
String op2;
int a,b,c;
int result;
public int ji(int a,String op,int b,String op2,int c)throws yichang{
if(op.equals("+")){
result=a+b;
}
if(op.equals("-")){
result=a-b;
}
if(op.equals("*")){
result=a*b;
}
if(op.equals("/")){
try{
if(b==0){
throw new yichang();
}
}catch(yichang e){
e.chufa();
}finally{};
result=a/b;
}
else{
try{throw new yichang();}catch(yichang e){
e.leixing();
}finally{};
}
if(op2.equals("+")){
result=result+c;
}
if(op2.equals("-")){
result=result+c;
}
if(op2.equals("*")){
result=result*c;
}
if(op2.equals("/")){
try{
if(c==0){
throw new yichang();
}
}catch(yichang e){
e.chufa();
}finally{};
result=result/c;
}
else {
try{
throw new yichang();
}catch(yichang e){
e.leixing();
}finally{};
}
return result;
}
}
class yichang extends Exception{
public void chufa(){
System.out.println("分母不能为0");
}
public void leixing(){
System.out.println("类型不对应");
}
}