package com.xzc.function;
import java.util.Scanner;
public class Homework {
//四个方法实现加减乘除
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("输入两个数字:");
double a = s.nextDouble();
double b = s.nextDouble();
System.out.println("请输入需要进行的操作:");
String oper = s.next();
switch(oper){
case "+":
System.out.println(add(a, b));
break;
case "-":
System.out.println(subtraction(a, b));
break;
case "*":
System.out.println(multiplication(a, b));
break;
case "/":
System.out.println(division(a, b));
break;
default:
System.out.println("No match");
break;
}
s
Java的小作业
最新推荐文章于 2022-10-14 00:31:58 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)