|
|
|
@ -6,16 +6,16 @@ public class Temperature{ |
|
|
|
System.out.println("请选择1/2"); |
|
|
|
int chioce=sc.nextlnt(); |
|
|
|
if (choice==1){ |
|
|
|
System.out.print("请输入温度:") |
|
|
|
System.out.print("请输入温度:"); |
|
|
|
double c=sc.nextDouble(); |
|
|
|
double f=c*9/5+32; |
|
|
|
System.out.printf("%.2f",f) |
|
|
|
System.out.printf("%.2f",f); |
|
|
|
}else if(choice==2){ |
|
|
|
System.out.print("请输入温度:") |
|
|
|
System.out.print("请输入温度:"); |
|
|
|
double c=sc.nextDouble(); |
|
|
|
double f=(c-32)*5/9; |
|
|
|
System.out.printf("%.2f",f) |
|
|
|
System.out.printf("%.2f",f); |
|
|
|
} |
|
|
|
sc.close |
|
|
|
sc.close(); |
|
|
|
} |
|
|
|
} |