0
私のメソッドを呼び出すのに助けが必要です。それは"the method fahrtoCel" is undefined for the "TempConversion"
と言います。CelciusからFahrまでのメソッドを使用していますが、メソッドは定義されていません
import java.util.Scanner;
public class TempConversion {
public static void main(String[] args) {
System.out.println("===CONVERTING TEMPERATURE=====");
ConvertTemp();
}
private static void ConvertTemp(){
Scanner s = new Scanner(System.in);
System.out.println("Press 1: Convert Celcius to Fahrenheit\nPress 2: Convert Fahrenheit to Celcius\n");
int select = s.nextInt();
if (select==1){
System.out.print("Enter the fahrenheit: ");
celtoFahr();
} else if (select==2){
System.out.print("Enter the celcius: ");
fahrtoCel();
} else{
System.out.println("exit");
}
private static void celtoFahr(){
double temperature = s.nextDouble();
double celcius = 5.0/9.0*(temperature-32);
}
private static void fahrtoCel(){
double temperature = s.nextDouble();
double fahrenheit = 9.0/5.0*(temperature+32);
}
}
}