小编Ron*_*ish的帖子

错误:摄氏无法解析为变量

使用以下代码获取错误:

import java.util.Scanner;
public class FahrenheitToCelsius{


 public static void main(String[]args){
    convertFToC();
 }

  /*gets input representing fahrenheit and displays celsius equivalent*/
  public static void convertFToC(){
    Scanner scan = new Scanner(System.in);
    System.out.println("Enter Fahrenheit temperature");
    double fahrenheit = scan.nextInt();            
    System.out.println(fahrenheit + " degrees Fahrenheit is " +
      fMethod(celsius) + " degrees Celsius");
  }


  /* calculates and returns the celsius equivalent */
  public static double toCelsius(double fahr){
    int BASE = 32;
    double CONVERSION_FACTOR = 9.0/ 5.0;
    double celsius = ((fahr-BASE)/(CONVERSION_FACTOR));
    return celsius;
  }
} …
Run Code Online (Sandbox Code Playgroud)

java variables methods

1
推荐指数
1
解决办法
1372
查看次数

标签 统计

java ×1

methods ×1

variables ×1