# 计算器的代码实现 还是不知道怎么进行累加(The code implementation of the calculator still doesn’t know how to accumulate)-其他

## 计算器的代码实现 还是不知道怎么进行累加(The code implementation of the calculator still doesn’t know how to accumulate)

``import java.util.Scanner;public class Test4 {    public static void main(String[] args) {        Scanner scanner = new Scanner(System.in);        System.out.println("请输入一个数字：");        while (scanner.hasNextDouble()) {            double e = scanner.nextDouble();            System.out.println("请再输入一个数字：");            double f = scanner.nextDouble();            System.out.println("请选择算法 加 减 乘 除：");            String k = scanner.next();            switch ( k) {                case "+":                    System.out.println((e + f));                    break;                case "-":                    System.out.println((e - f));                    break;                case "*":                    System.out.println((e * f));                    break;                case "/":                    System.out.println((e / f));                    break;                default:                    System.out.println("请输入正确的算法符号");            }        }        scanner.close();    }}``
————————
``import java.util.Scanner;public class Test4 {    public static void main(String[] args) {        Scanner scanner = new Scanner(System.in);        System.out.println("请输入一个数字：");        while (scanner.hasNextDouble()) {            double e = scanner.nextDouble();            System.out.println("请再输入一个数字：");            double f = scanner.nextDouble();            System.out.println("请选择算法 加 减 乘 除：");            String k = scanner.next();            switch ( k) {                case "+":                    System.out.println((e + f));                    break;                case "-":                    System.out.println((e - f));                    break;                case "*":                    System.out.println((e * f));                    break;                case "/":                    System.out.println((e / f));                    break;                default:                    System.out.println("请输入正确的算法符号");            }        }        scanner.close();    }}``