실험 4-단원 테스트
10607 단어 단원 테스트
import java.util.*;
public class jisuan {
public static void main(String[] args) {
System.out.println(" :+,-,*,/");
Scanner sc=new Scanner(System.in);
System.out.println(" :");
String str=sc.nextLine();
System.out.println(" :");
String str2=sc.nextLine();
System.out.println(" :");
String str3=sc.nextLine();
try{
double a=Double.parseDouble(str);
double b=Double.parseDouble(str2);
Core core=new Core();
core.fengzhuan(str3, a, b);
}catch(NumberFormatException e){
System.out.println(" , ");
Core core= new Core();
System.out.println(" :");
String str4=sc.nextLine();
System.out.println(" :");
String str5=sc.nextLine();
double a=Double.parseDouble(str4);
double b=Double.parseDouble(str5);
core.fengzhuan(str3, a, b);
}
finally{}
}
}
class Core {
Scanner g=new Scanner(System.in);
public void fengzhuan(String op,double a,double b){
if(op.equals("+")){
System.out.println(a+b);
}else if(op.equals("-")){
System.out.println(a-b);
}else if(op.equals("*")){
System.out.println(a*b);
}else if(op.equals("/")){
if(b==0){
System.out.println(" ");
System.out.println(" b :");
b=g.nextDouble();
System.out.println(a/b);
}
else if(b!=0){
System.out.println(a/b);
}
}
else{
String str3;
System.out.println(" , ");
str3=g.next();
jisuan2 ji=new jisuan2();
ji.huansuan(str3, a, b);
}
}
}
class jisuan2 extends jisuan{
Scanner sc=new Scanner(System.in);
public void huansuan(String str3,double a,double b){
if(str3.equals("+")){
System.out.println(a+b);
}else if(str3.equals("-")){
System.out.println(a-b);
}else if(str3.equals("*")){
System.out.println(a*b);
}else if(str3.equals("/")){
if(b==0){
System.out.println(" ");
System.out.println(" b :");
b=sc.nextDouble();
System.out.println(a/b);
}
else if(b!=0){
System.out.println(a/b);
}
}
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
[OutSystems] BDD Framework Client Side의 API 실행최근에 추가된 OutSystems의 Center Action 유닛 테스트를 위한 모듈, BDD Framework Client Side 이 모듈은 외부에서 자동으로 실행되는 BDD Framework와 동일한 REST ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.