这就是问题。请仅使用 switch 语句来执行此操作。这是我的代码。当我运行它时,它给了我错误。SS 错误http://prntscr.com/1dvvr7 帮我写代码 D:
public static void main(String[] args)
{
double Degrees_F,f,F;
double DegreesC,c,C;
double x;
int temp;
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter temperature ");
x=keyboard.nextInt( );
System.out.println("Enter C or c for Celcius or an F/f for Fahrenheit");
temp=keyboard.nextInt( );
switch (temp)
{
case 'C':
Degrees_F = 9*(x/5)+32;
System.out.println(x+"n Fahrenheit is"+Degrees_F);
break;
case 'c':
Degrees_F = 9*(x/5)+32;
System.out.println(x+"n Fahrenheit is"+Degrees_F);
}
}
}