谁能帮我修改下!~java

来源:百度知道 编辑:UC知道 时间:2024/06/24 21:57:09
import java.io.InputStreamReader;
import java.io.*;
import java.util.*;

public class Ca{
public static void main(String[] args) {
int c = 0,add = 1,sub = 2,mul = 3,div = 4;

Scanner sc = new Scanner(System.in);
double y;
double x;
String line;
String line1;

//System.out.println("输入y:");
line = sc.nextLine();
y = Integer.valueOf(line);
String fuHao = input.next();
///char c = fuHao.charAt(0);
//System.out.println("输入x:");
line1 = sc.nextLine();
x = Integer.valueOf(line);
switch (c){
case 1:System.out.println("y+x=" + (y+x) );
break;
case 2:System.out.println("y-x=" + (y-x) );
break;
case 3:System.out.println("y*x=" + (y*x) );
break;
case 4:System.out.println("y/x=" + (y/x) );
}
}
}

import java.io.InputStreamReader;
import java.io.*;
import java.util.*;

public class Ca {
public static void main(String[] args) {
char c, add = 1, sub = 2, mul = 3, div = 4;

Scanner sc1 = new Scanner(System.in);
Scanner sc2 = new Scanner(System.in);
Scanner sc3 = new Scanner(System.in);
double y;
double x;
String line;
String line1;

System.out.println("输入y:");
line = sc1.nextLine();
System.out.println("输入x:");

line1 = sc2.nextLine();
System.out.println("输入符号:");
String fuHao=sc3.nextLine();

y = Integer.valueOf(line);
x = Integer.valueOf(line1);
char c1 = fuHao.charAt(0);

switch (c1) {
case '+':
System.out.println("y+x=" + (y + x));
break;
case '-':
System.out.println("y-x=" + (y - x